diff --git a/0512785fbeb38b68e34884a59624192d186352e6.patch b/0512785fbeb38b68e34884a59624192d186352e6.patch new file mode 100644 index 0000000000000000000000000000000000000000..131e87df62d3bc1d515af3107aa61fc322856125 --- /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") diff --git a/python-pip.spec b/python-pip.spec index 05f810a986da3034c3f240b38e74be80b2c67322..c03f5adff37a3ce03319fadb32dcd0ff19891c32 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