• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python easy_install.easy_install函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_easy_install_cmd

    def get_easy_install_cmd(self, build_only=False, **kwargs):
        """ Returns a correctly setup easy_install cmd class for passing
            into `pkglib.setuptools.buildout.install`.
            Lifted from `setuptools.dist`

            Parameters
            ----------
            build_only : `bool`
                Configured for build and testing packages - these will be installed into the
                directory returned from `pkglib.manage.get_build_egg_dir`

            kwargs:
                Other kwargs to pass to easy_install constructor

            Returns
            -------
            cmd : `setuptools.Command`
                Configured command-class
        """
        dist = self.distribution.__class__({'script_args': ['easy_install']})
        dist.parse_config_files()

        if build_only:
            cmd = easy_install(
                dist, args=["x"], install_dir=manage.get_build_egg_dir(), exclude_scripts=True,
                always_copy=False, build_directory=None, editable=False,
                upgrade=False, multi_version=True, no_report=True, **kwargs)
        else:
            cmd = easy_install(dist, args=['x'], **kwargs)

        cmd.ensure_finalized()
        return cmd
开发者ID:NunoEdgarGub1,项目名称:pkglib,代码行数:32,代码来源:base.py


示例2: install_scripts

def install_scripts(distributions):
    """
    Regenerate the entry_points console_scripts for the named distribution.
    """
    try:
        if "__PEX_UNVENDORED__" in __import__("os").environ:
          from setuptools.command import easy_install  # vendor:skip
        else:
          from pex.third_party.setuptools.command import easy_install

        if "__PEX_UNVENDORED__" in __import__("os").environ:
          import pkg_resources  # vendor:skip
        else:
          import pex.third_party.pkg_resources as pkg_resources

    except ImportError:
        raise RuntimeError("'wheel install_scripts' needs setuptools.")

    for dist in distributions:
        pkg_resources_dist = pkg_resources.get_distribution(dist)
        install = get_install_command(dist)
        command = easy_install.easy_install(install.distribution)
        command.args = ['wheel']  # dummy argument
        command.finalize_options()
        command.install_egg_scripts(pkg_resources_dist)
开发者ID:jsirois,项目名称:pex,代码行数:25,代码来源:__init__.py


示例3: fetch_build_egg

	def fetch_build_egg(self, req):
		""" Specialized version of Distribution.fetch_build_egg
		that respects respects allow_hosts and index_url. """
		from setuptools.command.easy_install import easy_install
		dist = Distribution({'script_args': ['easy_install']})
		dist.parse_config_files()
		opts = dist.get_option_dict('easy_install')
		keep = (
			'find_links', 'site_dirs', 'index_url', 'optimize',
			'site_dirs', 'allow_hosts'
		)
		for key in list(opts):
			if key not in keep:
				del opts[key]  # don't use any other settings
		if self.dependency_links:
			links = self.dependency_links[:]
			if 'find_links' in opts:
				links = opts['find_links'][1].split() + links
			opts['find_links'] = ('setup', links)
		if self.allow_hosts:
			opts['allow_hosts'] = ('test', self.allow_hosts)
		if self.index_url:
			opts['index_url'] = ('test', self.index_url)
		install_dir_func = getattr(self, 'get_egg_cache_dir', _os.getcwd)
		install_dir = install_dir_func()
		cmd = easy_install(
			dist, args=["x"], install_dir=install_dir,
			exclude_scripts=True,
			always_copy=False, build_directory=None, editable=False,
			upgrade=False, multi_version=True, no_report=True, user=False
		)
		cmd.ensure_finalized()
		return cmd.easy_install(req)
开发者ID:blue-yonder,项目名称:pyscaffold,代码行数:33,代码来源:ptr.py


示例4: install_context

def install_context(request, tmpdir, monkeypatch):
    """Fixture to set up temporary installation directory.
    """
    # Save old values so we can restore them.
    new_cwd = tmpdir.mkdir("cwd")
    user_base = tmpdir.mkdir("user_base")
    user_site = tmpdir.mkdir("user_site")
    install_dir = tmpdir.mkdir("install_dir")

    def fin():
        # undo the monkeypatch, particularly needed under
        # windows because of kept handle on cwd
        monkeypatch.undo()
        new_cwd.remove()
        user_base.remove()
        user_site.remove()
        install_dir.remove()

    request.addfinalizer(fin)

    # Change the environment and site settings to control where the
    # files are installed and ensure we do not overwrite anything.
    monkeypatch.chdir(new_cwd)
    monkeypatch.setattr(easy_install_pkg, "__file__", user_site.strpath)
    monkeypatch.setattr("site.USER_BASE", user_base.strpath)
    monkeypatch.setattr("site.USER_SITE", user_site.strpath)
    monkeypatch.setattr("sys.path", sys.path + [install_dir.strpath])
    monkeypatch.setenv("PYTHONPATH", os.path.pathsep.join(sys.path))

    # Set up the command for performing the installation.
    dist = Distribution()
    cmd = easy_install(dist)
    cmd.install_dir = install_dir.strpath
    return cmd
开发者ID:Carlaisabelle,项目名称:mynewfirstblog,代码行数:34,代码来源:test_integration.py


示例5: _build_egg_fetcher

 def _build_egg_fetcher(self):
     """Build an egg fetcher that respects index_url and allow_hosts"""
     # modified from setuptools.dist:Distribution.fetch_build_egg
     from setuptools.command.easy_install import easy_install
     main_dist = self.distribution
     # construct a fake distribution to store the args for easy_install
     dist = main_dist.__class__({'script_args': ['easy_install']})
     dist.parse_config_files()
     opts = dist.get_option_dict('easy_install')
     keep = (
         'find_links', 'site_dirs', 'index_url', 'optimize',
         'site_dirs', 'allow_hosts'
     )
     for key in opts.keys():
         if key not in keep:
             del opts[key]   # don't use any other settings
     if main_dist.dependency_links:
         links = main_dist.dependency_links[:]
         if 'find_links' in opts:
             links = opts['find_links'][1].split() + links
         opts['find_links'] = ('setup', links)
     if self.allow_hosts:
         opts['allow_hosts'] = ('test', self.allow_hosts)
     if self.index_url:
         opts['index_url'] = ('test', self.index_url)
     install_dir_func = getattr(dist, 'get_egg_cache_dir', os.getcwd)
     install_dir = install_dir_func()
     cmd = easy_install(
         dist, args=["x"], install_dir=install_dir, exclude_scripts=True,
         always_copy=False, build_directory=None, editable=False,
         upgrade=False, multi_version=True, no_report = True
     )
     cmd.ensure_finalized()
     main_dist._egg_fetcher = cmd
开发者ID:gh0std4ncer,项目名称:pyscaffold,代码行数:34,代码来源:pytest_runner.py


示例6: test_install_site_py

 def test_install_site_py(self, tmpdir):
     dist = Distribution()
     cmd = ei.easy_install(dist)
     cmd.sitepy_installed = False
     cmd.install_dir = str(tmpdir)
     cmd.install_site_py()
     assert (tmpdir / 'site.py').exists()
开发者ID:apex1724,项目名称:setuptools,代码行数:7,代码来源:test_easy_install.py


示例7: install_context

def install_context(request, tmpdir, monkeypatch):
    """Fixture to set up temporary installation directory.
    """
    # Save old values so we can restore them.
    new_cwd = tmpdir.mkdir('cwd')
    user_base = tmpdir.mkdir('user_base')
    user_site = tmpdir.mkdir('user_site')
    install_dir = tmpdir.mkdir('install_dir')

    def fin():
        new_cwd.remove()
        user_base.remove()
        user_site.remove()
        install_dir.remove()
    request.addfinalizer(fin)

    # Change the environment and site settings to control where the
    # files are installed and ensure we do not overwrite anything.
    monkeypatch.chdir(new_cwd)
    monkeypatch.setattr(easy_install_pkg, '__file__', user_site.strpath)
    monkeypatch.setattr('site.USER_BASE', user_base.strpath)
    monkeypatch.setattr('site.USER_SITE', user_site.strpath)
    monkeypatch.setattr('sys.path', sys.path + [install_dir.strpath])
    monkeypatch.setenv('PYTHONPATH', os.path.pathsep.join(sys.path))

    # Set up the command for performing the installation.
    dist = Distribution()
    cmd = easy_install(dist)
    cmd.install_dir = install_dir.strpath
    return cmd
开发者ID:Alan502,项目名称:MacWorld,代码行数:30,代码来源:test_integration.py


示例8: fetch_build_egg

    def fetch_build_egg(self, req):
        """Fetch an egg needed for building"""
        try:
            cmd = self._egg_fetcher
        except AttributeError:
            from setuptools.command.easy_install import easy_install

            dist = self.__class__({"script_args": ["easy_install"]})
            dist.parse_config_files()
            opts = dist.get_option_dict("easy_install")
            keep = ("find_links", "site_dirs", "index_url", "optimize", "site_dirs", "allow_hosts")
            for key in opts.keys():
                if key not in keep:
                    del opts[key]  # don't use any other settings
            if self.dependency_links:
                links = self.dependency_links[:]
                if "find_links" in opts:
                    links = opts["find_links"][1].split() + links
                opts["find_links"] = ("setup", links)
            cmd = easy_install(
                dist,
                args=["x"],
                install_dir=os.curdir,
                exclude_scripts=True,
                always_copy=False,
                build_directory=None,
                editable=False,
                upgrade=False,
                multi_version=True,
                no_report=True,
            )
            cmd.ensure_finalized()
            self._egg_fetcher = cmd
        return cmd.easy_install(req)
开发者ID:arlogriffiths,项目名称:isaw.web,代码行数:34,代码来源:dist.py


示例9: fetch_build_egg

    def fetch_build_egg(self, req):
        """Fetch an egg needed for building"""

        try:
            cmd = self._egg_fetcher
            cmd.package_index.to_scan = []
        except AttributeError:
            from setuptools.command.easy_install import easy_install
            dist = self.__class__({'script_args':['easy_install']})
            dist.parse_config_files()
            opts = dist.get_option_dict('easy_install')
            keep = (
                'find_links', 'site_dirs', 'index_url', 'optimize',
                'site_dirs', 'allow_hosts'
            )
            for key in list(opts.keys()):
                if key not in keep:
                    del opts[key]   # don't use any other settings
            if self.dependency_links:
                links = self.dependency_links[:]
                if 'find_links' in opts:
                    links = opts['find_links'][1].split() + links
                opts['find_links'] = ('setup', links)
            cmd = easy_install(
                dist, args=["x"], install_dir=os.curdir, exclude_scripts=True,
                always_copy=False, build_directory=None, editable=False,
                upgrade=False, multi_version=True, no_report=True, user=False
            )
            cmd.ensure_finalized()
            self._egg_fetcher = cmd
        return cmd.easy_install(req)
开发者ID:jmavila,项目名称:python,代码行数:31,代码来源:dist.py


示例10: fetch_build_egg

 def fetch_build_egg(self, req):
     """Fetch an egg needed for building"""
     from setuptools.command.easy_install import easy_install
     dist = self.__class__({'script_args': ['easy_install']})
     opts = dist.get_option_dict('easy_install')
     opts.clear()
     opts.update(
         (k, v)
         for k, v in self.get_option_dict('easy_install').items()
         if k in (
             # don't use any other settings
             'find_links', 'site_dirs', 'index_url',
             'optimize', 'site_dirs', 'allow_hosts',
         ))
     if self.dependency_links:
         links = self.dependency_links[:]
         if 'find_links' in opts:
             links = opts['find_links'][1] + links
         opts['find_links'] = ('setup', links)
     install_dir = self.get_egg_cache_dir()
     cmd = easy_install(
         dist, args=["x"], install_dir=install_dir,
         exclude_scripts=True,
         always_copy=False, build_directory=None, editable=False,
         upgrade=False, multi_version=True, no_report=True, user=False
     )
     cmd.ensure_finalized()
     return cmd.easy_install(req)
开发者ID:AlerzDev,项目名称:Brazo-Proyecto-Final,代码行数:28,代码来源:dist.py


示例11: test_local_index

    def test_local_index(self):
        # make sure the local index is used
        # when easy_install looks for installed
        # packages
        new_location = tempfile.mkdtemp()
        target = tempfile.mkdtemp()
        egg_file = os.path.join(new_location, 'foo-1.0.egg-info')
        f = open(egg_file, 'w')
        try:
            f.write('Name: foo\n')
        except:
            f.close()

        sys.path.append(target)
        old_ppath = os.environ.get('PYTHONPATH')
        os.environ['PYTHONPATH'] = ':'.join(sys.path)
        try:
            dist = Distribution()
            dist.script_name = 'setup.py'
            cmd = easy_install(dist)
            cmd.install_dir = target
            cmd.args = ['foo']
            cmd.ensure_finalized()
            cmd.local_index.scan([new_location])
            res = cmd.easy_install('foo')
            self.assertEquals(res.location, new_location)
        finally:
            sys.path.remove(target)
            shutil.rmtree(new_location)
            shutil.rmtree(target)
            if old_ppath is not None:
                os.environ['PYTHONPATH'] = old_ppath
            else:
                del os.environ['PYTHONPATH']
开发者ID:runt18,项目名称:jython-plugin,代码行数:34,代码来源:test_easy_install.py


示例12: assert_not_user_site

 def assert_not_user_site():
     # create a finalized easy_install command
     dist = Distribution()
     dist.script_name = 'setup.py'
     cmd = ei.easy_install(dist)
     cmd.args = ['py']
     cmd.ensure_finalized()
     assert not cmd.user, 'user should not be implied'
开发者ID:17264138,项目名称:IndividualProject,代码行数:8,代码来源:test_easy_install.py


示例13: test_write_exception

 def test_write_exception(self):
     """
     Test that `cant_write_to_target` is rendered as a DistutilsError.
     """
     dist = Distribution()
     cmd = ei.easy_install(dist)
     cmd.install_dir = os.getcwd()
     with pytest.raises(distutils.errors.DistutilsError):
         cmd.cant_write_to_target()
开发者ID:17264138,项目名称:IndividualProject,代码行数:9,代码来源:test_easy_install.py


示例14: test_user_install_implied

 def test_user_install_implied(self):
     site.ENABLE_USER_SITE = True # disabled sometimes
     #XXX: replace with something meaningfull
     dist = Distribution()
     dist.script_name = 'setup.py'
     cmd = easy_install(dist)
     cmd.args = ['py']
     cmd.ensure_finalized()
     self.assertTrue(cmd.user, 'user should be implied')
开发者ID:13lcp2000,项目名称:recetario4-4,代码行数:9,代码来源:test_easy_install.py


示例15: test_user_install_not_implied_without_usersite_enabled

 def test_user_install_not_implied_without_usersite_enabled(self):
     site.ENABLE_USER_SITE = False # usually enabled
     #XXX: replace with something meaningfull
     dist = Distribution()
     dist.script_name = 'setup.py'
     cmd = easy_install(dist)
     cmd.args = ['py']
     cmd.initialize_options()
     assert not cmd.user, 'NOT user should be implied'
开发者ID:yuexizhaohong,项目名称:python,代码行数:9,代码来源:test_easy_install.py


示例16: fetch_build_egg

 def fetch_build_egg(self, req):
     try:
         cmd = self._egg_fetcher
     except AttributeError:
         dist = self.__class__({'script_args': ['easy_install']})
         dist.parse_config_files()
         cmd = easy_install.easy_install(dist, args=['x'],
                                         index_url=get_index_url())
         cmd.ensure_finalized()
         self._egg_fetcher = cmd
     return cmd.easy_install(req)
开发者ID:drkjam,项目名称:pkglib,代码行数:11,代码来源:setup.py


示例17: test_install_site_py

 def test_install_site_py(self):
     dist = Distribution()
     cmd = easy_install(dist)
     cmd.sitepy_installed = False
     cmd.install_dir = tempfile.mkdtemp()
     try:
         cmd.install_site_py()
         sitepy = os.path.join(cmd.install_dir, 'site.py')
         self.assertTrue(os.path.exists(sitepy))
     finally:
         shutil.rmtree(cmd.install_dir)
开发者ID:Ansen,项目名称:openshift-xmpptalk-ircbindxmpp-bundle,代码行数:11,代码来源:test_easy_install.py


示例18: test_user_install_not_implied_without_usersite_enabled

 def test_user_install_not_implied_without_usersite_enabled(self):
     easy_install_pkg.HAS_USER_SITE = False # usually enabled
     #XXX: replace with something meaningfull
     if sys.version < "2.6":
         return #SKIP
     dist = Distribution()
     dist.script_name = 'setup.py'
     cmd = easy_install(dist)
     cmd.args = ['py']
     cmd.initialize_options()
     self.assertFalse(cmd.user, 'NOT user should be implied')
开发者ID:Ansen,项目名称:openshift-xmpptalk-ircbindxmpp-bundle,代码行数:11,代码来源:test_easy_install.py


示例19: test_user_install_implied

 def test_user_install_implied(self):
     easy_install_pkg.HAS_USER_SITE = True # disabled sometimes
     #XXX: replace with something meaningfull
     if sys.version < "2.6":
         return #SKIP
     dist = Distribution()
     dist.script_name = 'setup.py'
     cmd = easy_install(dist)
     cmd.args = ['py']
     cmd.ensure_finalized()
     self.assertTrue(cmd.user, 'user should be implied')
开发者ID:Ansen,项目名称:openshift-xmpptalk-ircbindxmpp-bundle,代码行数:11,代码来源:test_easy_install.py


示例20: test_unicode_content_in_sdist

 def test_unicode_content_in_sdist(
         self, sdist_unicode_in_script, tmpdir, monkeypatch):
     """
     The install command should execute correctly even if
     the package has unicode in scripts.
     """
     dist = Distribution({"script_args": ["easy_install"]})
     target = (tmpdir / "target").ensure_dir()
     cmd = ei.easy_install(dist, install_dir=str(target), args=["x"])
     monkeypatch.setitem(os.environ, "PYTHONPATH", str(target))
     cmd.ensure_finalized()
     cmd.easy_install(sdist_unicode_in_script)
开发者ID:benoit-pierre,项目名称:setuptools,代码行数:12,代码来源:test_easy_install.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python easy_install.get_script_header函数代码示例发布时间:2022-05-27
下一篇:
Python develop.run函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap