当前位置: 首页>>代码示例>>Python>>正文


Python easy_install.main方法代码示例

本文整理汇总了Python中setuptools.command.easy_install.main方法的典型用法代码示例。如果您正苦于以下问题:Python easy_install.main方法的具体用法?Python easy_install.main怎么用?Python easy_install.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在setuptools.command.easy_install的用法示例。


在下文中一共展示了easy_install.main方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def main(argv, version=DEFAULT_VERSION):
    """Install or upgrade setuptools and EasyInstall"""
    try:
        import setuptools
    except ImportError:
        egg = None
        try:
            egg = download_setuptools(version, delay=0)
            sys.path.insert(0,egg)
            from setuptools.command.easy_install import main
            return main(list(argv)+[egg])   # we're done here
        finally:
            if egg and os.path.exists(egg):
                os.unlink(egg)
    else:
        if setuptools.__version__ == '0.0.1':
            print((
            "You have an obsolete version of setuptools installed.  Please\n"
            "remove it from your system entirely before rerunning this script."
            ), file=sys.stderr)
            sys.exit(2)

    req = "setuptools>="+version
    import pkg_resources
    try:
        pkg_resources.require(req)
    except pkg_resources.VersionConflict:
        try:
            from setuptools.command.easy_install import main
        except ImportError:
            from easy_install import main
        main(list(argv)+[download_setuptools(delay=0)])
        sys.exit(0) # try to force an exit
    else:
        if argv:
            from setuptools.command.easy_install import main
            main(argv)
        else:
            print("Setuptools version",version,"or greater has been installed.")
            print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)') 
开发者ID:trackmastersteve,项目名称:alienfx,代码行数:42,代码来源:ez_setup.py

示例2: test_setup_requires_honors_fetch_params

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def test_setup_requires_honors_fetch_params(self):
        """
        When easy_install installs a source distribution which specifies
        setup_requires, it should honor the fetch parameters (such as
        allow-hosts, index-url, and find-links).
        """
        # set up a server which will simulate an alternate package index.
        p_index = setuptools.tests.server.MockServer()
        p_index.start()
        netloc = 1
        p_index_loc = urlparse(p_index.url)[netloc]
        if p_index_loc.endswith(':0'):
            # Some platforms (Jython) don't find a port to which to bind,
            #  so skip this test for them.
            return
        with quiet_context():
            # create an sdist that has a build-time dependency.
            with TestSetupRequires.create_sdist() as dist_file:
                with tempdir_context() as temp_install_dir:
                    with environment_context(PYTHONPATH=temp_install_dir):
                        ei_params = ['--index-url', p_index.url,
                            '--allow-hosts', p_index_loc,
                            '--exclude-scripts', '--install-dir', temp_install_dir,
                            dist_file]
                        with reset_setup_stop_context():
                            with argv_context(['easy_install']):
                                # attempt to install the dist. It should fail because
                                #  it doesn't exist.
                                self.assertRaises(SystemExit,
                                    easy_install_pkg.main, ei_params)
        # there should have been two or three requests to the server
        #  (three happens on Python 3.3a)
        self.assertTrue(2 <= len(p_index.requests) <= 3)
        self.assertEqual(p_index.requests[0].path, '/does-not-exist/') 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:36,代码来源:test_easy_install.py

示例3: main

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def main(argv, version=DEFAULT_VERSION):
    """Install or upgrade setuptools and EasyInstall"""
    try:
        import setuptools
    except ImportError:
        egg = None
        try:
            egg = download_setuptools(version, delay=0)
            sys.path.insert(0,egg)
            from setuptools.command.easy_install import main
            return main(list(argv)+[egg])   # we're done here
        finally:
            if egg and os.path.exists(egg):
                os.unlink(egg)
    else:
        if setuptools.__version__ == '0.0.1':
            print >>sys.stderr, (
            "You have an obsolete version of setuptools installed.  Please\n"
            "remove it from your system entirely before rerunning this script."
            )
            sys.exit(2)

    req = "setuptools>="+version
    import pkg_resources
    try:
        pkg_resources.require(req)
    except pkg_resources.VersionConflict:
        try:
            from setuptools.command.easy_install import main
        except ImportError:
            from easy_install import main
        main(list(argv)+[download_setuptools(delay=0)])
        sys.exit(0) # try to force an exit
    else:
        if argv:
            from setuptools.command.easy_install import main
            main(argv)
        else:
            print "Setuptools version",version,"or greater has been installed."
            print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' 
开发者ID:google,项目名称:apis-client-generator,代码行数:42,代码来源:ez_setup.py

示例4: main

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def main(argv, version=DEFAULT_VERSION):
    """Install or upgrade setuptools and EasyInstall"""

    try:
        import setuptools
    except ImportError:
        egg = None
        try:
            egg = download_setuptools(version, delay=0)
            sys.path.insert(0,egg)
            from setuptools.command.easy_install import main
            return main(list(argv)+[egg])   # we're done here
        finally:
            if egg and os.path.exists(egg):
                os.unlink(egg)
    else:
        if setuptools.__version__ == '0.0.1':
            # tell the user to uninstall obsolete version
            use_setuptools(version)

    req = "setuptools>="+version
    import pkg_resources
    try:
        pkg_resources.require(req)
    except pkg_resources.VersionConflict:
        try:
            from setuptools.command.easy_install import main
        except ImportError:
            from easy_install import main
        main(list(argv)+[download_setuptools(delay=0)])
        sys.exit(0) # try to force an exit
    else:
        if argv:
            from setuptools.command.easy_install import main
            main(argv)
        else:
            print("Setuptools version",version,"or greater has been installed.")
            print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)') 
开发者ID:cihologramas,项目名称:pyoptools,代码行数:40,代码来源:ez_setup.py

示例5: test_setup_requires_honors_fetch_params

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def test_setup_requires_honors_fetch_params(self, mock_index, monkeypatch):
        """
        When easy_install installs a source distribution which specifies
        setup_requires, it should honor the fetch parameters (such as
        index-url, and find-links).
        """
        monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
        monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
        with contexts.quiet():
            # create an sdist that has a build-time dependency.
            with TestSetupRequires.create_sdist() as dist_file:
                with contexts.tempdir() as temp_install_dir:
                    with contexts.environment(PYTHONPATH=temp_install_dir):
                        ei_params = [
                            '--index-url', mock_index.url,
                            '--exclude-scripts',
                            '--install-dir', temp_install_dir,
                            dist_file,
                        ]
                        with sandbox.save_argv(['easy_install']):
                            # attempt to install the dist. It should
                            # fail because it doesn't exist.
                            with pytest.raises(SystemExit):
                                easy_install_pkg.main(ei_params)
        # there should have been one requests to the server
        assert [r.path for r in mock_index.requests] == ['/does-not-exist/'] 
开发者ID:pypa,项目名称:setuptools,代码行数:28,代码来源:test_easy_install.py

示例6: main

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def main():
    parser = optparse.OptionParser()
    parser.add_option('-d', '--download-dir',
        help='Directory with maually downloaded python modules.'
    )
    opts, _ = parser.parse_args()

    # Install packages.
    for k, v in _PACKAGES.items():
        # Test python version for module.
        if k in _PY_VERSION:
            # Python version too old, skip module.
            if PYVER < _PY_VERSION[k]:
                continue
        try:
            __import__(k)
            print 'Already installed... %s' % k
        # Module is not available - install it.
        except ImportError:
            # If not url or module name then look for installers in download area.
            if not v[0].startswith('http') and v[0].endswith('exe'):
                files = []
                # Try all file patterns.
                for pattern in v:
                    pattern = os.path.join(opts.download_dir, pattern)
                    files += glob.glob(pattern)
                # No file with that pattern was not found - skip it.
                if not files:
                    print 'Skipping module... %s' % k
                    continue
                # Full path to installers in download directory.
                v = files
            print 'Installing module... %s' % k
            # Some modules might require several .exe files to install.
            for f in v:
                print '  %s' % f
                # Use --no-deps ... installing module dependencies might fail
                # because easy_install tries to install the same module from
                # PYPI from source code and if fails because of C code that
                # that needs to be compiled.
                easy_install.main(['--no-deps', '--always-unzip', f]) 
开发者ID:Lithium876,项目名称:ConTroll_Remote_Access_Trojan,代码行数:43,代码来源:setupenv_windows.py

示例7: main

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def main(argv, version=DEFAULT_VERSION):
    """Install or upgrade setuptools and EasyInstall"""
    try:
        import setuptools
    except ImportError:
        egg = None
        try:
            egg = download_setuptools(version, delay=0)
            sys.path.insert(0,egg)
            from setuptools.command.easy_install import main
            return main(list(argv)+[egg])   # we're done here
        finally:
            if egg and os.path.exists(egg):
                os.unlink(egg)
    else:
        if setuptools.__version__ == '0.0.1':
            print >>sys.stderr, (
            "You have an obsolete version of setuptools installed.  Please\n"
            "remove it from your system entirely before rerunning this script."
            )
            sys.exit(2)
    req = "setuptools>="+version
    import pkg_resources
    try:
        pkg_resources.require(req)
    except pkg_resources.VersionConflict:
        try:
            from setuptools.command.easy_install import main
        except ImportError:
            from easy_install import main
        main(list(argv)+[download_setuptools(delay=0)])
        sys.exit(0) # try to force an exit
    else:
        if argv:
            from setuptools.command.easy_install import main
            main(argv)
        else:
            print "Setuptools version",version,"or greater has been installed."
            print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' 
开发者ID:peckhams,项目名称:topoflow,代码行数:41,代码来源:ez_setup.py

示例8: test_setup_requires_honors_fetch_params

# 需要导入模块: from setuptools.command import easy_install [as 别名]
# 或者: from setuptools.command.easy_install import main [as 别名]
def test_setup_requires_honors_fetch_params(self):
        """
        When easy_install installs a source distribution which specifies
        setup_requires, it should honor the fetch parameters (such as
        allow-hosts, index-url, and find-links).
        """
        # set up a server which will simulate an alternate package index.
        p_index = setuptools.tests.server.MockServer()
        p_index.start()
        netloc = 1
        p_index_loc = urlparse(p_index.url)[netloc]
        if p_index_loc.endswith(':0'):
            # Some platforms (Jython) don't find a port to which to bind,
            #  so skip this test for them.
            return
        # create an sdist that has a build-time dependency.
        with TestSetupRequires.create_sdist() as dist_file:
            with tempdir_context() as temp_install_dir:
                with environment_context(PYTHONPATH=temp_install_dir):
                    ei_params = ['--index-url', p_index.url,
                        '--allow-hosts', p_index_loc,
                        '--exclude-scripts', '--install-dir', temp_install_dir,
                        dist_file]
                    with reset_setup_stop_context():
                        with argv_context(['easy_install']):
                            # attempt to install the dist. It should fail because
                            #  it doesn't exist.
                            self.assertRaises(SystemExit,
                                easy_install_pkg.main, ei_params)
        # there should have been two or three requests to the server
        #  (three happens on Python 3.3a)
        self.assertTrue(2 <= len(p_index.requests) <= 3)
        self.assertEqual(p_index.requests[0].path, '/does-not-exist/') 
开发者ID:GeekTrainer,项目名称:Flask,代码行数:35,代码来源:test_easy_install.py


注:本文中的setuptools.command.easy_install.main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。