コード例 #1
0
    def install(self):
        old_sys_path = sys.path
        try:
            save_path = self.download()
            sys.path.insert(0, save_path)
            # Run ez_setup.py to install setuptools
            from ez_setup import main
            try:
                main([])
            except SystemExit, e:
                if e.code != 0:
                    raise InstallationError("Setuptools installation failed.")

            # Load previously-installed packages/eggs in new python dir
            addsitedir(os.path.dirname(save_path))
コード例 #2
0
ファイル: install.py プロジェクト: weallen/Seqwill
    def install(self):
        old_sys_path = sys.path
        try:
            save_path = self.download()
            sys.path.insert(0, save_path)
            # Run ez_setup.py to install setuptools
            from ez_setup import main
            try:
                main([])
            except SystemExit, e:
                if e.code != 0:
                    raise InstallationError("Setuptools installation failed.")

            # Load previously-installed packages/eggs in new python dir
            addsitedir(os.path.dirname(save_path))
コード例 #3
0
def main(argv = None):  
    if not argv:
        argv = sys.argv
    
    #ARG PARSING    
    parser = optparse.OptionParser(usage=__doc__)
    parser.add_option("-l", "--install-dir", dest="libdir",
                      help="""Directory that libraries will be installed, use if you do not have root access
                            You will need to set your PYTHONPATH environment variable for this procedure""")
    parser.add_option("-g", "--egg-dir",dest="eggdir", default=sys.path[0],
                      help="""Egg directory for scanning.""")
    parser.add_option("-e", "--easy-install", dest="easyinstalldir", 
                      help="""The path to easy_install, if it does not exist on the default path.""")
    parser.add_option("-s", "--script-dir", dest="scriptdir",
                      help="""Directory you would like to executeables to. Defaults to working directory when run""")
    
    dctOptions, lstArgs = parser.parse_args(argv)
    
    #BASE DIRECTORIES
    if dctOptions.scriptdir:
        script_dir = dctOptions.scriptdir
    else:
        script_dir = sys.path[0]
        
    #LOOK FOR CONFIG FILE
    dependencies = []
    config_file = findFiles(sys.path[0], re.compile("Install.cfg", re.IGNORECASE))
    if config_file:
        fConfig = open(config_file[0])
        print "Found Config File: " + config_file[0]
        for line in fConfig:
            dependencies.append(line)
            print "Found Dependency: " + line
        
    #EASYINSTALL
    if not dctOptions.easyinstalldir:
        
        print "INSTALLING SETUPTOOLS"
        print "\n------------------------------------------------\n"
        
        try:
            import ez_setup
        except:
            try:
                from data import ez_setup
            except:
                print "\nUnable to load SetupTools, please either install easy_install or have ez_setup.py in the same directory as this program\n"
                print "If you have easy_install already on your system, use --easy-install to define it's location"
                sys.exit(1)
                
        
        if not dctOptions.libdir:
            items = ["--script-dir=" + script_dir, "-U", "setuptools"]
        else:
            items = ["--script-dir=" + script_dir, "--install-dir=" + os.path.expanduser(dctOptions.libdir), "-U", "setuptools"]
        
        #CAPTURE OUTPUT FROM EZSETUP
        saved = sys.stdout
        net = StringIO()
        sys.stdout = net
        ez_setup.main(items)
        sys.stdout = saved
        net.seek(0)
        
        #SEARCH FOR INSTALLATION DIRECTORY OF EASY INSTALL
        p1 = re.compile('Installing easy_install script to', re.IGNORECASE)
        for line in net.readlines():
            print line
            m1 = p1.match(line)
            if m1:
                install_items = line.split()
                setattr(dctOptions, 'easyinstalldir', install_items[len(install_items)-1])
                break
    
    #FIND EGGS
    Eggs = findFiles(dctOptions.eggdir, re.compile("[.]egg", re.IGNORECASE))
    easyinstall = os.path.join(dctOptions.easyinstalldir, "easy_install")
    Eggs += dependencies
    
    #INSTALL EGGS
    for Egg in Eggs:
        print "\n------------------------------------------------\n"
        print "SETTING UP " + Egg + ":"
        try:
            if dctOptions.libdir:
                lstArgs = [easyinstall, "--script-dir=" + script_dir, "--install-dir=" + os.path.expanduser(dctOptions.libdir), "-U", Egg]
            else:
                lstArgs = [easyinstall, "--script-dir=" + script_dir, "-U", Egg]
            check_call(lstArgs)
            print "\n------------------------------------------------\n"
        except:
            print "\n------------------------------------------------\n"
            continue
コード例 #4
0
ファイル: XNATInstallWizard.py プロジェクト: jcfr/XNATSlicer
                self.installStatusDialog.showMessage("Copying file '%s' to '%s' "%
                                                     (fileN, os.path.join(self.installPaths[val], 
                                                                          os.path.basename(fileN))))
            else: 
                shutil.copy(fileN, os.path.join(self.installPaths["pyRoot"], os.path.basename(fileN)))
                self.installStatusDialog.showMessage("Copying file '%s' to '%s' "%
                                                     (fileN, os.path.join(self.installPaths[val], 
                                                                          os.path.basename(fileN))))
        #=======================================================================
        # STEP 4: Initiate subprocess calls
        #=======================================================================
        fileN = os.path.join(self.installPaths["pyRoot"], "ez_setup.py")
        self.installStatusDialog.showMessage("Running '%s' "%(fileN))
        import subprocess
        import ez_setup
        print ez_setup.main("")        
        slicer.app.processEvents()
        easyInst = os.path.join(self.installPaths["pyRoot"], "Scripts/easy_install")
        #=======================================================================
        # STEP 5: Construct and run command
        #=======================================================================
        command = "\"" + os.path.normpath(easyInst) + "\"" + " httplib2"      
        self.beginProcess(command, "httplib2")
        slicer.app.processEvents()

        command = ("\"" + os.path.normpath(easyInst) + "\"" 
                   + " " + "\"" + 
                   os.path.normpath(os.path.join(self.installPaths["pyRoot"], 
                                                                "lxml-2.2.8-py2.6-win-amd64.egg")) + "\"")
        self.beginProcess(command, "lxml")
        slicer.app.processEvents()#test
コード例 #5
0
# Get ez_setup:
ez_setup_path = os.path.join(site_dir, 'ez_setup.py')
if not os.path.exists(ez_setup_path):
    f = file(ez_setup_path, 'w')
    f.write(
        urllib2.urlopen(
            'http://peak.telecommunity.com/dist/ez_setup.py').read())
    f.close()

# Install nose if not present
try:
    import nose
except ImportError:
    import ez_setup
    ez_setup.main(['--install-dir', site_dir, 'nose'])
    for mod in sys.modules.keys():
        if mod.startswith('nose'):
            del sys.modules[mod]
    for path in sys.path:
        if path.startswith(site_dir):
            sys.path.remove(site_dir)
    site.addsitedir(site_dir)
    import nose

print "find tests in ", TESTS_DIR
# Run Tests!
nose.run(argv=[
    'nosetests', '-v', '--with-xunit', '--where=' +
    TESTS_DIR, '--xunit-file=' + cwd + '/TEST-Sikuli-Python-Suite.xml'
] + sys.argv[1:])
コード例 #6
0
ファイル: install.py プロジェクト: overload08/domoweb
def main():
    """Main function that is called at the install of Domoweb."""
    from optparse import OptionParser
    p = OptionParser(usage="usage: %prog [options]",
                     version="Install for Domoweb 0.4")

    p.add_option('--uninstall',
                 dest='uninstall',
                 action="store_true",
                 help="Uninstall Domoweb")

    p.add_option('--simul',
                 dest='simul',
                 action="store_true",
                 help="Simulation mode for Uninstall")

    p.add_option('--nodeps',
                 dest='nodeps',
                 action="store_true",
                 help="Do not install dependencies")

    p.add_option('-u',
                 '--user',
                 dest='user',
                 default=None,
                 help="User that will run Domoweb (default: domoweb)")

    p.add_option(
        '--libdir',
        dest='libdir',
        default='/var/lib/domoweb',
        help="Folder for domoweb lib files (default: /var/lib/domoweb)")

    p.add_option(
        '--logdir',
        dest='logdir',
        default='/var/log/domoweb',
        help="Folder for domoweb log files (default: /var/log/domoweb)")

    p.add_option(
        '--piddir',
        dest='piddir',
        default='/var/run/domoweb',
        help="Folder for domoweb pid files (default: /var/run/domoweb)")

    p.add_option('--noconfig',
                 dest='noconfig',
                 action="store_true",
                 help="Do not install Init and /etc files")

    p.add_option('--nodbupdate',
                 dest='nodbupdate',
                 action="store_true",
                 help="Do not update the Domoweb DB")

    p.add_option('--notest',
                 dest='notest',
                 action="store_true",
                 help="Do not test Domoweb Installation")

    p.add_option(
        '--db',
        dest='db',
        default='/var/lib/domoweb/db.sqlite',
        help="Force domoweb DB file (default: /var/lib/domoweb/db.sqlite)")

    p.add_option('--noclean',
                 dest='noclean',
                 action="store_true",
                 help="Do not clean old Domoweb install")

    p.add_option('--nousercheck',
                 dest='nousercheck',
                 action="store_true",
                 help="Do not check for user account")

    p.add_option('--nofoldercreation',
                 dest='nofoldercreation',
                 action="store_true",
                 help="Do not create folders")

    # parse command line for defined options
    options, args = p.parse_args()

    # Initial Clean
    if not options.noclean:
        clean()

    # Uninstall
    if options.uninstall:
        uninstall(options.simul)
        sys.exit(0)

    # Dependencies
    if options.nodeps:
        warning('Not installing dependencies')
    else:
        info("Installing setuptools...")
        import ez_setup
        ez_setup.main('')
        info("Installing dependencies...")
        install_dependencies()

    # Domoweb User
    if options.nousercheck:
        warning('Not checking user')
    else:
        info("Checking user")
        if options.user:
            user = options.user
        else:
            user = raw_input(
                'Which user will run domogik (default : domoweb)? ')
            if not user:
                user = '******'
        test_user(user)

    # Domoweb folders creation
    if options.nofoldercreation:
        warning('Not creating folders')
    else:
        info("Checking %s folder" % options.libdir)
        createFolder(options.libdir, user)
        info("Checking %s folder" % options.logdir)
        createFolder(options.logdir, user)
        info("Checking %s folder" % options.piddir)
        createFolder(options.piddir, user)
        info("Copying default files")
        installFiles(options.libdir, user)

    # Config files
    if options.noconfig:
        warning('Not installing Init and /etc files')
    else:
        upgradeOld()
        installConfig(user)
        installDefault(user)
        installInit()
        installLogrotate()

    # Update DB
    if options.nodbupdate:
        warning('Not updating Domoweb DB')
    else:
        info("Updating Domoweb DB...")
        updateDb(user, options.db)

    # Adding module path to PYTHONPATH
    if sitepackages:
        mypth = os.path.join(sitepackages, "domoweb.pth")
        path_to_add = os.path.abspath(os.path.dirname(__file__))
        ok("Adding %s to site-packages" % path_to_add)
        with open(mypth, "a") as f:
            f.write(path_to_add)
            f.write("\n")
    else:
        fail('site-packages not found')

    # Test installation
    if options.notest:
        warning('Not testing Domoweb Installation')
    else:
        ok("Everything seems to be good, DomoWeb should be installed correctly."
           )
        ok("Testing installation")
        #raw_input('Please press Enter when ready.')
        try:
            testConfigFiles()
            testInit()
            tornado_url = getTornadoUrl()
            print "\n\n"
            ok("================================================== <==")
            ok(" Everything seems ok, you should be able to start  <==")
            ok("      DomoWeb with /etc/init.d/domoweb start       <==")
            ok("            or /etc/rc.d/domoweb start             <==")
            ok(" DomoWeb UI is available on                        <==")
            ok(" %49s <==" % tornado_url)
            ok("================================================== <==")
        except:
            fail(sys.exc_info()[1])
コード例 #7
0
ファイル: install.py プロジェクト: ka2er/domoweb
def main():
    """Main function that is called at the install of Domoweb."""
    from optparse import OptionParser
    p = OptionParser(usage="usage: %prog [options]",
                          version="Install for Domoweb 0.4")

    p.add_option('--uninstall',
             dest='uninstall',
             action="store_true",
             help="Uninstall Domoweb")

    p.add_option('--simul',
             dest='simul',
             action="store_true",
             help="Simulation mode for Uninstall")

    p.add_option('--nodeps',
             dest='nodeps',
             action="store_true",
             help="Do not install dependencies")

    p.add_option('-u', '--user',
             dest='user',
             default=None,
             help="User that will run Domoweb (default: domoweb)")

    p.add_option('--libdir',
             dest='libdir',
             default='/var/lib/domoweb',
             help="Folder for domoweb lib files (default: /var/lib/domoweb)")

    p.add_option('--logdir',
             dest='logdir',
             default='/var/log/domoweb',
             help="Folder for domoweb log files (default: /var/log/domoweb)")

    p.add_option('--piddir',
             dest='piddir',
             default='/var/run/domoweb',
             help="Folder for domoweb pid files (default: /var/run/domoweb)")

    p.add_option('--noconfig',
             dest='noconfig',
             action="store_true",
             help="Do not install Init and /etc files")

    p.add_option('--nodbupdate',
             dest='nodbupdate',
             action="store_true",
             help="Do not update the Domoweb DB")

    p.add_option('--notest',
             dest='notest',
             action="store_true",
             help="Do not test Domoweb Installation")

    p.add_option('--db',
             dest='db',
             default='/var/lib/domoweb/db.sqlite',
             help="Force domoweb DB file (default: /var/lib/domoweb/db.sqlite)")

    p.add_option('--noclean',
             dest='noclean',
             action="store_true",
             help="Do not clean old Domoweb install")

    p.add_option('--nousercheck',
             dest='nousercheck',
             action="store_true",
             help="Do not check for user account")

    p.add_option('--nofoldercreation',
             dest='nofoldercreation',
             action="store_true",
             help="Do not create folders")
    
    # parse command line for defined options
    options, args = p.parse_args()

    # Initial Clean
    if not options.noclean:
        clean()

    # Uninstall
    if options.uninstall:
        uninstall(options.simul)
        sys.exit(0)

    # Dependencies
    if options.nodeps:
        warning('Not installing dependencies')
    else:
        info("Installing setuptools...")
        import ez_setup
        ez_setup.main('')
        info("Installing dependencies...")
        install_dependencies()

    # Domoweb User
    if options.nousercheck:
        warning('Not checking user')
    else:
        info("Checking user")
        if options.user:
            user = options.user
        else:
            user = raw_input('Which user will run domogik (default : domoweb)? ')
            if not user:
                user = '******'
        test_user(user)

    # Domoweb folders creation
    if options.nofoldercreation:
        warning('Not creating folders')
    else:
        info("Checking %s folder" % options.libdir)
        createFolder(options.libdir, user)
        info("Checking %s folder" % options.logdir)
        createFolder(options.logdir, user)
        info("Checking %s folder" % options.piddir)
        createFolder(options.piddir, user)
        info("Copying default files")
        installFiles(options.libdir, user)

    # Config files
    if options.noconfig:
        warning('Not installing Init and /etc files')
    else:
        upgradeOld()
        installConfig(user)
        installDefault(user)
        installInit()
        installLogrotate()

    # Update DB
    if options.nodbupdate:
        warning('Not updating Domoweb DB')
    else:
        info("Updating Domoweb DB...")
        updateDb(user, options.db)

    # Adding module path to PYTHONPATH
    if sitepackages:
        mypth = os.path.join(sitepackages, "domoweb.pth")
        path_to_add = os.path.abspath(os.path.dirname(__file__))
        ok("Adding %s to site-packages" % path_to_add)
        with open(mypth, "a") as f:
            f.write(path_to_add)
            f.write("\n")
    else:
        fail('site-packages not found')

    # Test installation
    if options.notest:
        warning('Not testing Domoweb Installation')
    else:
        ok("Everything seems to be good, DomoWeb should be installed correctly.")
        ok("Testing installation")
        raw_input('Please press Enter when ready.')
        try:
            testConfigFiles()
            testInit()
            tornado_url = getTornadoUrl()
            print "\n\n"
            ok("================================================== <==")
            ok(" Everything seems ok, you should be able to start  <==")
            ok("      DomoWeb with /etc/init.d/domoweb start       <==")
            ok("            or /etc/rc.d/domoweb start             <==")
            ok(" DomoWeb UI is available on                        <==")
            ok(" %49s <==" % tornado_url)
            ok("================================================== <==")
        except:
            fail(sys.exc_info()[1])
コード例 #8
0
ファイル: develop.py プロジェクト: bendavis78/zope
    try:
        # check if we have ez_setup available
        import ez_setup

    except ImportError, e:
        # retrieve ez_setup.py from the interweb
        EZ_URL = "http://peak.telecommunity.com/dist/ez_setup.py"

        ez_filename = os.path.join(os.path.dirname(__file__), 'ez_setup.py')
        file(ez_filename, 'w').write(urllib2.urlopen(EZ_URL).read())

        import ez_setup

    os.environ['PYTHONPATH'] = (os.environ.setdefault('PYTHONPATH', '') + ":" +
                                libdir)
    ez_setup.main(
        ['--install-dir', libdir, '--script-dir', bindir, '-U', 'setuptools'])


def initSetupCfg(setup_file, template_file='setup.cfg.in'):
    """Check if the setup_file (setup.cfg) exists; if it doesn't, and
    setup.cfg.in does, copy setup.cfg.in to setup.cfg to serve as a
    template."""

    if not (os.path.exists(setup_file)) and os.path.exists(template_file):
        shutil.copyfile(template_file, setup_file)


def updateSetupCfg(setup_file, opts):
    """Update or create a setup.cfg (setup_file) for working on this
    project."""
コード例 #9
0
############################## MAIN #########################
def main(args=sys.argv[1:]):
    env = Environment()
    env.initialize()

    installers = [
        SetuptoolsInstaller(),
        Hdf5Installer(env),
        NumpyInstaller(),
        RInstaller(env),
        Rpy2Installer(),
        RlibsInstaller(),
        PytablesInstaller(),
        SegtoolsInstaller()
    ]

    for installer in installers:
        installer.run()
        # Next step may need just-installed eggs, so update site list
        env.refresh_packages()

    # DONE: Test package installations?
    TestSuite().run([PytablesTester()])

    env.close()


if __name__ == "__main__":
    sys.exit(main())
コード例 #10
0
ファイル: install.py プロジェクト: weallen/Seqwill
class GenomedataInstaller(EasyInstaller):
    name = "Genomedata"
    min_version = PKG_VERSION
    get_version = EasyInstaller.get_egg_version

############################## MAIN #########################
def main(args=sys.argv[1:]):
    env = Environment()
    env.initialize()

    installers = [SetuptoolsInstaller(),
                  Hdf5Installer(env),
                  NumpyInstaller(),
                  PytablesInstaller(),
                  GenomedataInstaller()]

    for installer in installers:
        installer.run()
        # Next step may need just-installed eggs, so update site list
        env.refresh_packages()

    # DONE: Test package installations?
    TestSuite().run([PytablesTester()])

    env.close()

if __name__ == "__main__":
    sys.exit(main())

コード例 #11
0
ファイル: install.py プロジェクト: linked2safety/code
def install(package, version = None):
	if len(package) == 0:
		return
	if version!=None and len(version)>0:
		package = "%(p)s==%(v)s" % {"p" : package, "v" : version}
	ez_setup.main([package])
コード例 #12
0
ファイル: RunNoseTests.py プロジェクト: Chiene/sikuli
os.environ["PYTHONPATH"] = os.pathsep.join(sys.path)

# Get ez_setup:
ez_setup_path = os.path.join(site_dir, "ez_setup.py")
if not os.path.exists(ez_setup_path):
    f = file(ez_setup_path, "w")
    f.write(urllib2.urlopen("http://peak.telecommunity.com/dist/ez_setup.py").read())
    f.close()

# Install nose if not present
try:
    import nose
except ImportError:
    import ez_setup

    ez_setup.main(["--install-dir", site_dir, "nose"])
    for mod in sys.modules.keys():
        if mod.startswith("nose"):
            del sys.modules[mod]
    for path in sys.path:
        if path.startswith(site_dir):
            sys.path.remove(site_dir)
    site.addsitedir(site_dir)
    import nose


print "find tests in ", TESTS_DIR
# Run Tests!
nose.run(
    argv=[
        "nosetests",