From 24ac17ba74d29c7596c03f998c6c0c72abf37937 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Tue, 3 Nov 2020 19:30:11 +0800 Subject: [PATCH 1/2] [patch tracking] 20201103193007638690 - https://github.com/pypa/pip/commit/0512785fbeb38b68e34884a59624192d186352e6 --- ...785fbeb38b68e34884a59624192d186352e6.patch | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 0512785fbeb38b68e34884a59624192d186352e6.patch diff --git a/0512785fbeb38b68e34884a59624192d186352e6.patch b/0512785fbeb38b68e34884a59624192d186352e6.patch new file mode 100644 index 0000000..131e87d --- /dev/null +++ b/0512785fbeb38b68e34884a59624192d186352e6.patch @@ -0,0 +1,84 @@ +diff --git a/news/9083.bugfix.rst b/news/9083.bugfix.rst +new file mode 100644 +index 0000000000..97fc552b6f +--- /dev/null ++++ b/news/9083.bugfix.rst +@@ -0,0 +1,3 @@ ++New resolver: Check version equality with ``packaging.version`` to avoid edge ++cases if a wheel used different version normalization logic in its filename ++and metadata. +diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py +index ff2b336d9e..65585fd36a 100644 +--- a/src/pip/_internal/resolution/resolvelib/candidates.py ++++ b/src/pip/_internal/resolution/resolvelib/candidates.py +@@ -283,9 +283,10 @@ def __init__( + ) + # Version may not be present for PEP 508 direct URLs + if version is not None: +- assert str(version) == wheel.version, ( ++ wheel_version = Version(wheel.version) ++ assert version == wheel_version, ( + "{!r} != {!r} for wheel {}".format( +- version, wheel.version, name ++ version, wheel_version, name + ) + ) + +diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py +index 0465975eec..374d37aeea 100644 +--- a/tests/functional/test_new_resolver.py ++++ b/tests/functional/test_new_resolver.py +@@ -11,6 +11,7 @@ + create_basic_wheel_for_package, + create_test_package_with_setup, + ) ++from tests.lib.wheel import make_wheel + + + def assert_installed(script, **kwargs): +@@ -1089,3 +1090,45 @@ def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N): + assert result.stdout.count("This could take a while.") >= 2 + if N >= 13: + assert "press Ctrl + C" in result.stdout ++ ++ ++@pytest.mark.parametrize( ++ "metadata_version", ++ [ ++ "0.1.0+local.1", # Normalized form. ++ "0.1.0+local_1", # Non-normalized form containing an underscore. ++ ++ # Non-normalized form containing a dash. This is allowed, installation ++ # works correctly, but assert_installed() fails because pkg_resources ++ # cannot handle it correctly. Nobody is complaining about it right now, ++ # we're probably dropping it for importlib.metadata soon(tm), so let's ++ # ignore it for the time being. ++ pytest.param("0.1.0+local-1", marks=pytest.mark.xfail), ++ ], ++ ids=["meta_dot", "meta_underscore", "meta_dash"], ++) ++@pytest.mark.parametrize( ++ "filename_version", ++ [ ++ ("0.1.0+local.1"), # Tools are encouraged to use this. ++ ("0.1.0+local_1"), # But this is allowed (version not normalized). ++ ], ++ ids=["file_dot", "file_underscore"], ++) ++def test_new_resolver_check_wheel_version_normalized( ++ script, ++ metadata_version, ++ filename_version, ++): ++ filename = "simple-{}-py2.py3-none-any.whl".format(filename_version) ++ ++ wheel_builder = make_wheel(name="simple", version=metadata_version) ++ wheel_builder.save_to(script.scratch_path / filename) ++ ++ script.pip( ++ "install", ++ "--no-cache-dir", "--no-index", ++ "--find-links", script.scratch_path, ++ "simple" ++ ) ++ assert_installed(script, simple="0.1.0+local.1") -- Gitee From abaef1c03b06f76855242e73c79bc00cf24ff1e8 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Tue, 3 Nov 2020 19:30:12 +0800 Subject: [PATCH 2/2] [patch tracking] 20201103193007638690 - 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 05f810a..c03f5ad 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -7,7 +7,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: 2 +Release: 3 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 @@ -17,6 +17,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: 0512785fbeb38b68e34884a59624192d186352e6.patch Source10: pip-allow-older-versions.patch %description %{_description} @@ -140,6 +141,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %{python_wheeldir}/%{python_wheelname} %changelog +* 20201103193007638690 patch-tracking 20.2.2-3 +- append patch file of upstream repository from <0512785fbeb38b68e34884a59624192d186352e6> to <0512785fbeb38b68e34884a59624192d186352e6> + * Tue Sep 1 2020 wenzhanli - 20.2.2-2 - add pip-allow-older-versions.patch @@ -183,4 +187,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