當前位置: 首頁>>代碼示例>>Python>>正文


Python pkg_resources.Requirement方法代碼示例

本文整理匯總了Python中pip._vendor.pkg_resources.Requirement方法的典型用法代碼示例。如果您正苦於以下問題:Python pkg_resources.Requirement方法的具體用法?Python pkg_resources.Requirement怎麽用?Python pkg_resources.Requirement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pip._vendor.pkg_resources的用法示例。


在下文中一共展示了pkg_resources.Requirement方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: prepare_installed_requirement

# 需要導入模塊: from pip._vendor import pkg_resources [as 別名]
# 或者: from pip._vendor.pkg_resources import Requirement [as 別名]
def prepare_installed_requirement(self, req, require_hashes, skip_reason):
        """Prepare an already-installed requirement
        """
        assert req.satisfied_by, "req should have been satisfied but isn't"
        assert skip_reason is not None, (
            "did not get skip reason skipped but req.satisfied_by "
            "is set to %r" % (req.satisfied_by,)
        )
        logger.info(
            'Requirement %s: %s (%s)',
            skip_reason, req, req.satisfied_by.version
        )
        with indent_log():
            if require_hashes:
                logger.debug(
                    'Since it is already installed, we are trusting this '
                    'package without checking its hash. To ensure a '
                    'completely repeatable environment, install into an '
                    'empty virtualenv.'
                )
            abstract_dist = Installed(req)

        return abstract_dist 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:25,代碼來源:prepare.py

示例2: prep_for_dist

# 需要導入模塊: from pip._vendor import pkg_resources [as 別名]
# 或者: from pip._vendor.pkg_resources import Requirement [as 別名]
def prep_for_dist(self, finder, build_isolation):
        # Before calling "setup.py egg_info", we need to set-up the build
        # environment.
        build_requirements, isolate = self.req.get_pep_518_info()
        should_isolate = build_isolation and isolate

        minimum_requirements = ('setuptools', 'wheel')
        missing_requirements = set(minimum_requirements) - set(
            pkg_resources.Requirement(r).key
            for r in build_requirements
        )
        if missing_requirements:
            def format_reqs(rs):
                return ' and '.join(map(repr, sorted(rs)))
            logger.warning(
                "Missing build time requirements in pyproject.toml for %s: "
                "%s.", self.req, format_reqs(missing_requirements)
            )
            logger.warning(
                "This version of pip does not implement PEP 517 so it cannot "
                "build a wheel without %s.", format_reqs(minimum_requirements)
            )

        if should_isolate:
            with self.req.build_env:
                pass
            _install_build_reqs(finder, self.req.build_env.path,
                                build_requirements)
        else:
            self.req.build_env = NoOpBuildEnvironment(no_clean=False)

        self.req.run_egg_info()
        self.req.assert_source_matches_version() 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:35,代碼來源:prepare.py

示例3: prep_for_dist

# 需要導入模塊: from pip._vendor import pkg_resources [as 別名]
# 或者: from pip._vendor.pkg_resources import Requirement [as 別名]
def prep_for_dist(self, finder, build_isolation):
        # Before calling "setup.py egg_info", we need to set-up the build
        # environment.
        build_requirements, isolate = self.req.get_pep_518_info()
        should_isolate = build_isolation and isolate

        minimum_requirements = ('setuptools', 'wheel')
        missing_requirements = set(minimum_requirements) - set(
            pkg_resources.Requirement(r).key
            for r in build_requirements
        )
        if missing_requirements:
            def format_reqs(rs):
                return ' and '.join(map(repr, sorted(rs)))
            logger.warning(
                "Missing build time requirements in pyproject.toml for %s: "
                "%s.", self.req, format_reqs(missing_requirements)
            )
            logger.warning(
                "This version of pip does not implement PEP 517 so it cannot "
                "build a wheel without %s.", format_reqs(minimum_requirements)
            )

        if should_isolate:
            with self.req.build_env as prefix:
                _install_build_reqs(finder, prefix, build_requirements)
        else:
            self.req.build_env = NoOpBuildEnvironment(no_clean=False)

        self.req.run_egg_info()
        self.req.assert_source_matches_version() 
開發者ID:wangzhenjjcn,項目名稱:FuYiSpider,代碼行數:33,代碼來源:prepare.py

示例4: prep_for_dist

# 需要導入模塊: from pip._vendor import pkg_resources [as 別名]
# 或者: from pip._vendor.pkg_resources import Requirement [as 別名]
def prep_for_dist(self, finder, build_isolation):
        # Before calling "setup.py egg_info", we need to set-up the build
        # environment.
        build_requirements = self.req.get_pep_518_info()
        should_isolate = build_isolation and build_requirements is not None

        if should_isolate:
            # Haven't implemented PEP 517 yet, so spew a warning about it if
            # build-requirements don't include setuptools and wheel.
            missing_requirements = {'setuptools', 'wheel'} - {
                pkg_resources.Requirement(r).key for r in build_requirements
            }
            if missing_requirements:
                logger.warning(
                    "Missing build requirements in pyproject.toml for %s.",
                    self.req,
                )
                logger.warning(
                    "This version of pip does not implement PEP 517 so it "
                    "cannot build a wheel without %s.",
                    " and ".join(map(repr, sorted(missing_requirements)))
                )

            # Isolate in a BuildEnvironment and install the build-time
            # requirements.
            self.req.build_env = BuildEnvironment()
            self.req.build_env.install_requirements(
                finder, build_requirements,
                "Installing build dependencies"
            )

        self.req.run_egg_info()
        self.req.assert_source_matches_version() 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:35,代碼來源:prepare.py


注:本文中的pip._vendor.pkg_resources.Requirement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。