Python pip._vendor.pkg_resources.Requirement() Examples

The following are 18 code examples of pip._vendor.pkg_resources.Requirement(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pip._vendor.pkg_resources , or try the search function .
Example #1
Source File: prepare.py    From hacktoberfest2018 with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #2
Source File: prepare.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
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 
Example #3
Source File: prepare.py    From guildai with Apache License 2.0 6 votes vote down vote up
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 
Example #4
Source File: prepare.py    From stopstalk-deployment with MIT License 6 votes vote down vote up
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 
Example #5
Source File: prepare.py    From hacktoberfest2018 with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #6
Source File: prepare.py    From GraphicDesignPatternByPython with MIT License 6 votes vote down vote up
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 
Example #7
Source File: prepare.py    From FuYiSpider with Apache License 2.0 6 votes vote down vote up
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 
Example #8
Source File: prepare.py    From FuYiSpider with Apache License 2.0 6 votes vote down vote up
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 
Example #9
Source File: prepare.py    From Python24 with MIT License 6 votes vote down vote up
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 
Example #10
Source File: prepare.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
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() 
Example #11
Source File: prepare.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #12
Source File: prepare.py    From Python24 with MIT License 5 votes vote down vote up
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() 
Example #13
Source File: prepare.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #14
Source File: prepare.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
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() 
Example #15
Source File: prepare.py    From stopstalk-deployment with MIT License 5 votes vote down vote up
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() 
Example #16
Source File: prepare.py    From guildai with Apache License 2.0 5 votes vote down vote up
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() 
Example #17
Source File: prepare.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
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() 
Example #18
Source File: prepare.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
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()