From a8944bfed7cc201aa692f4dfaa751ccba20ff3a8 Mon Sep 17 00:00:00 2001 From: q0w <43147888+q0w@users.noreply.github.com> Date: Thu, 27 Jan 2022 22:04:37 +0300 Subject: [PATCH] Dont check packages with ignore_dependencies --- src/pip/_internal/operations/check.py | 4 +++- src/pip/_internal/req/constructors.py | 2 +- src/pip/_internal/req/req_file.py | 2 -- src/pip/_internal/resolution/resolvelib/candidates.py | 1 + src/pip/_internal/resolution/resolvelib/provider.py | 5 ++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pip/_internal/operations/check.py b/src/pip/_internal/operations/check.py index fb3ac8b9c9e..dfee2a18883 100644 --- a/src/pip/_internal/operations/check.py +++ b/src/pip/_internal/operations/check.py @@ -100,7 +100,9 @@ def check_install_conflicts(to_install: List[InstallRequirement]) -> ConflictDet # Start from the current state package_set, _ = create_package_set_from_installed() # Install packages - would_be_installed = _simulate_installation_of(to_install, package_set) + would_be_installed = _simulate_installation_of( + list(filter(lambda x: not x.ignore_dependencies, to_install)), package_set + ) # Only warn about directly-dependent packages; create a whitelist of them whitelist = _create_whitelist(would_be_installed, package_set) diff --git a/src/pip/_internal/req/constructors.py b/src/pip/_internal/req/constructors.py index 4756d660f8c..449467d3f77 100644 --- a/src/pip/_internal/req/constructors.py +++ b/src/pip/_internal/req/constructors.py @@ -403,7 +403,7 @@ def install_req_from_line( install_options=options.get("install_options", []) if options else [], global_options=options.get("global_options", []) if options else [], hash_options=options.get("hashes", {}) if options else {}, - ignore_dependencies=options.get("ignore_dependencies", False) + ignore_dependencies=options.get("ignore_dependencies", ignore_dependencies) if options else ignore_dependencies, constraint=constraint, diff --git a/src/pip/_internal/req/req_file.py b/src/pip/_internal/req/req_file.py index 582c8b0513d..e3aabb66662 100644 --- a/src/pip/_internal/req/req_file.py +++ b/src/pip/_internal/req/req_file.py @@ -190,8 +190,6 @@ def handle_requirement_line( if options: # Disable wheels if the user has specified build options cmdoptions.check_install_build_global(options, line.opts) - if line.opts.ignore_dependencies: - options.ignore_dependencies = True # get the options that apply to requirements req_options = {} diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py index 83dbc09695f..f96ffc5d25a 100644 --- a/src/pip/_internal/resolution/resolvelib/candidates.py +++ b/src/pip/_internal/resolution/resolvelib/candidates.py @@ -117,6 +117,7 @@ def _make_install_req_from_dist( install_options=template.install_options, global_options=template.global_options, hashes=template.hash_options, + ignore_dependencies=template.ignore_dependencies, ), ) ireq.satisfied_by = dist diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py index 7725d512b0a..fe417b1d646 100644 --- a/src/pip/_internal/resolution/resolvelib/provider.py +++ b/src/pip/_internal/resolution/resolvelib/provider.py @@ -234,10 +234,9 @@ def is_satisfied_by(self, requirement: Requirement, candidate: Candidate) -> boo def get_dependencies(self, candidate: Candidate) -> Sequence[Requirement]: install_req = candidate.get_install_requirement() - if install_req: + with_requires = not self._ignore_dependencies + if install_req and with_requires: with_requires = not install_req.ignore_dependencies - else: - with_requires = not self._ignore_dependencies return [r for r in candidate.iter_dependencies(with_requires) if r is not None] @staticmethod