From 86c07732cbc1829e04c5cf41046d014e6050c9d3 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 23 Nov 2020 19:30:12 +0800 Subject: [PATCH 1/2] [patch tracking] 20201123193007640242 - https://github.com/pypa/pip/commit/84382715f05e89b3f12d6c2b74bf72e0d701103c --- ...2715f05e89b3f12d6c2b74bf72e0d701103c.patch | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 84382715f05e89b3f12d6c2b74bf72e0d701103c.patch diff --git a/84382715f05e89b3f12d6c2b74bf72e0d701103c.patch b/84382715f05e89b3f12d6c2b74bf72e0d701103c.patch new file mode 100644 index 0000000..e1091be --- /dev/null +++ b/84382715f05e89b3f12d6c2b74bf72e0d701103c.patch @@ -0,0 +1,278 @@ +diff --git a/src/pip/_internal/resolution/resolvelib/base.py b/src/pip/_internal/resolution/resolvelib/base.py +index 7c09cd70b8..e2edbe9f42 100644 +--- a/src/pip/_internal/resolution/resolvelib/base.py ++++ b/src/pip/_internal/resolution/resolvelib/base.py +@@ -58,6 +58,13 @@ def __and__(self, other): + hashes = self.hashes & other.hashes(trust_internet=False) + return Constraint(specifier, hashes) + ++ def is_satisfied_by(self, candidate): ++ # type: (Candidate) -> bool ++ # We can safely always allow prereleases here since PackageFinder ++ # already implements the prerelease logic, and would have filtered out ++ # prerelease candidates if the user does not expect them. ++ return self.specifier.contains(candidate.version, prereleases=True) ++ + + class Requirement(object): + @property +diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py +index 65585fd36a..1fc2ff479a 100644 +--- a/src/pip/_internal/resolution/resolvelib/candidates.py ++++ b/src/pip/_internal/resolution/resolvelib/candidates.py +@@ -143,6 +143,10 @@ def __init__( + self._version = version + self._dist = None # type: Optional[Distribution] + ++ def __str__(self): ++ # type: () -> str ++ return "{} {}".format(self.name, self.version) ++ + def __repr__(self): + # type: () -> str + return "{class_name}({link!r})".format( +@@ -359,6 +363,10 @@ def __init__( + skip_reason = "already satisfied" + factory.preparer.prepare_installed_requirement(self._ireq, skip_reason) + ++ def __str__(self): ++ # type: () -> str ++ return str(self.dist) ++ + def __repr__(self): + # type: () -> str + return "{class_name}({distribution!r})".format( +@@ -445,6 +453,11 @@ def __init__( + self.base = base + self.extras = extras + ++ def __str__(self): ++ # type: () -> str ++ name, rest = str(self.base).split(" ", 1) ++ return "{}[{}] {}".format(name, ",".join(self.extras), rest) ++ + def __repr__(self): + # type: () -> str + return "{class_name}(base={base!r}, extras={extras!r})".format( +@@ -554,6 +567,10 @@ def __init__(self, py_version_info): + # only one RequiresPythonCandidate in a resolution, i.e. the host Python. + # The built-in object.__eq__() and object.__ne__() do exactly what we want. + ++ def __str__(self): ++ # type: () -> str ++ return "Python {}".format(self._version) ++ + @property + def name(self): + # type: () -> str +diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py +index c65cb7f76f..f4177d981f 100644 +--- a/src/pip/_internal/resolution/resolvelib/factory.py ++++ b/src/pip/_internal/resolution/resolvelib/factory.py +@@ -235,16 +235,10 @@ def find_candidates( + prefers_installed, + ) + +- if constraint: +- name = explicit_candidates.pop().name +- raise InstallationError( +- "Could not satisfy constraints for {!r}: installation from " +- "path or url cannot be constrained to a version".format(name) +- ) +- + return ( + c for c in explicit_candidates +- if all(req.is_satisfied_by(c) for req in requirements) ++ if constraint.is_satisfied_by(c) ++ and all(req.is_satisfied_by(c) for req in requirements) + ) + + def make_requirement_from_install_req(self, ireq, requested_extras): +diff --git a/src/pip/_internal/resolution/resolvelib/requirements.py b/src/pip/_internal/resolution/resolvelib/requirements.py +index bc1061f430..25cddceaf6 100644 +--- a/src/pip/_internal/resolution/resolvelib/requirements.py ++++ b/src/pip/_internal/resolution/resolvelib/requirements.py +@@ -17,6 +17,10 @@ def __init__(self, candidate): + # type: (Candidate) -> None + self.candidate = candidate + ++ def __str__(self): ++ # type: () -> str ++ return str(self.candidate) ++ + def __repr__(self): + # type: () -> str + return "{class_name}({candidate!r})".format( +@@ -106,6 +110,10 @@ def __init__(self, specifier, match): + self.specifier = specifier + self._candidate = match + ++ def __str__(self): ++ # type: () -> str ++ return "Python {}".format(self.specifier) ++ + def __repr__(self): + # type: () -> str + return "{class_name}({specifier!r})".format( +@@ -120,7 +128,7 @@ def name(self): + + def format_for_error(self): + # type: () -> str +- return "Python " + str(self.specifier) ++ return str(self) + + def get_candidate_lookup(self): + # type: () -> CandidateLookup +diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py +index 575adbe157..c5985243b6 100644 +--- a/tests/functional/test_install_reqs.py ++++ b/tests/functional/test_install_reqs.py +@@ -341,7 +341,11 @@ def test_constraints_only_causes_error(script, data): + assert 'installed requiresupper' not in result.stdout + + +-def test_constraints_local_editable_install_causes_error(script, data): ++def test_constraints_local_editable_install_causes_error( ++ script, ++ data, ++ resolver_variant, ++): + script.scratch_path.joinpath("constraints.txt").write_text( + "singlemodule==0.0.0" + ) +@@ -350,7 +354,11 @@ def test_constraints_local_editable_install_causes_error(script, data): + 'install', '--no-index', '-f', data.find_links, '-c', + script.scratch_path / 'constraints.txt', '-e', + to_install, expect_error=True) +- assert 'Could not satisfy constraints for' in result.stderr ++ if resolver_variant == "legacy-resolver": ++ assert 'Could not satisfy constraints' in result.stderr, str(result) ++ else: ++ # Because singlemodule only has 0.0.1 available. ++ assert 'No matching distribution found' in result.stderr, str(result) + + + @pytest.mark.network +@@ -362,7 +370,11 @@ def test_constraints_local_editable_install_pep518(script, data): + 'install', '--no-index', '-f', data.find_links, '-e', to_install) + + +-def test_constraints_local_install_causes_error(script, data): ++def test_constraints_local_install_causes_error( ++ script, ++ data, ++ resolver_variant, ++): + script.scratch_path.joinpath("constraints.txt").write_text( + "singlemodule==0.0.0" + ) +@@ -371,7 +383,11 @@ def test_constraints_local_install_causes_error(script, data): + 'install', '--no-index', '-f', data.find_links, '-c', + script.scratch_path / 'constraints.txt', + to_install, expect_error=True) +- assert 'Could not satisfy constraints for' in result.stderr ++ if resolver_variant == "legacy-resolver": ++ assert 'Could not satisfy constraints' in result.stderr, str(result) ++ else: ++ # Because singlemodule only has 0.0.1 available. ++ assert 'No matching distribution found' in result.stderr, str(result) + + + def test_constraints_constrain_to_local_editable( +diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py +index 374d37aeea..45e1a03470 100644 +--- a/tests/functional/test_new_resolver.py ++++ b/tests/functional/test_new_resolver.py +@@ -712,22 +712,40 @@ def test_new_resolver_constraint_on_dependency(script): + assert_installed(script, dep="2.0") + + +-def test_new_resolver_constraint_on_path(script): ++@pytest.mark.parametrize( ++ "constraint_version, expect_error, message", ++ [ ++ ("1.0", True, "ERROR: No matching distribution found for foo 2.0"), ++ ("2.0", False, "Successfully installed foo-2.0"), ++ ], ++) ++def test_new_resolver_constraint_on_path_empty( ++ script, ++ constraint_version, ++ expect_error, ++ message, ++): ++ """A path requirement can be filtered by a constraint. ++ """ + setup_py = script.scratch_path / "setup.py" + text = "from setuptools import setup\nsetup(name='foo', version='2.0')" + setup_py.write_text(text) ++ + constraints_txt = script.scratch_path / "constraints.txt" +- constraints_txt.write_text("foo==1.0") ++ constraints_txt.write_text("foo=={}".format(constraint_version)) ++ + result = script.pip( + "install", + "--no-cache-dir", "--no-index", + "-c", constraints_txt, + str(script.scratch_path), +- expect_error=True, ++ expect_error=expect_error, + ) + +- msg = "installation from path or url cannot be constrained to a version" +- assert msg in result.stderr, str(result) ++ if expect_error: ++ assert message in result.stderr, str(result) ++ else: ++ assert message in result.stdout, str(result) + + + def test_new_resolver_constraint_only_marker_match(script): +@@ -1132,3 +1150,46 @@ def test_new_resolver_check_wheel_version_normalized( + "simple" + ) + assert_installed(script, simple="0.1.0+local.1") ++ ++ ++def test_new_resolver_contraint_on_dep_with_extra(script): ++ create_basic_wheel_for_package( ++ script, ++ name="simple", ++ version="1", ++ depends=["dep[x]"], ++ ) ++ create_basic_wheel_for_package( ++ script, ++ name="dep", ++ version="1", ++ extras={"x": ["depx==1"]}, ++ ) ++ create_basic_wheel_for_package( ++ script, ++ name="dep", ++ version="2", ++ extras={"x": ["depx==2"]}, ++ ) ++ create_basic_wheel_for_package( ++ script, ++ name="depx", ++ version="1", ++ ) ++ create_basic_wheel_for_package( ++ script, ++ name="depx", ++ version="2", ++ ) ++ ++ constraints_txt = script.scratch_path / "constraints.txt" ++ constraints_txt.write_text("dep==1") ++ ++ script.pip( ++ "install", ++ "--no-cache-dir", "--no-index", ++ "--find-links", script.scratch_path, ++ "--constraint", constraints_txt, ++ "simple", ++ ) ++ assert_installed(script, simple="1", dep="1", depx="1") -- Gitee From 3799052c6dd848dbd44a1d2ca47a5ac5a2e8f712 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 23 Nov 2020 19:30:13 +0800 Subject: [PATCH 2/2] [patch tracking] 20201123193007640242 - update spec file --- python-pip.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python-pip.spec b/python-pip.spec index 3d035b5..7dddda8 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -6,7 +6,7 @@ pip is the package installer for Python. You can use pip to install packages fro %global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d}) Name: python-%{srcname} Version: 20.2.2 -Release: 3 +Release: 4 Summary: A tool for installing and managing Python packages License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD) URL: http://www.pip-installer.org @@ -16,6 +16,7 @@ Patch1: allow-stripping-given-prefix-from-wheel-RECORD-files.patch Patch2: emit-a-warning-when-running-with-root-privileges.patch Patch3: remove-existing-dist-only-if-path-conflicts.patch Patch6000: dummy-certifi.patch +Patch6001: 84382715f05e89b3f12d6c2b74bf72e0d701103c.patch Source10: pip-allow-older-versions.patch %description %{_description} @@ -112,6 +113,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %{python_wheeldir}/%{python_wheelname} %changelog +* 20201123193007640242 patch-tracking 20.2.2-4 +- append patch file of upstream repository from <84382715f05e89b3f12d6c2b74bf72e0d701103c> to <84382715f05e89b3f12d6c2b74bf72e0d701103c> + * Wed Nov 4 2020 wangjie -20.2.2-3 - Type:NA - ID:NA @@ -161,4 +165,4 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} - DESC: Synchronize a patch * Mon Sep 23 2019 openEuler Buildteam - 18.0-6 -- Package init +- Package init \ No newline at end of file -- Gitee