diff --git a/2e11f312d0072aa14ff744eafbfe9b32f09f190c.patch b/2e11f312d0072aa14ff744eafbfe9b32f09f190c.patch new file mode 100644 index 0000000000000000000000000000000000000000..1224797a9e6be5d875332094cd549a3f4da35487 --- /dev/null +++ b/2e11f312d0072aa14ff744eafbfe9b32f09f190c.patch @@ -0,0 +1,74 @@ +diff --git a/src/pip/_internal/index/package_finder.py b/src/pip/_internal/index/package_finder.py +index b361e194d7..9f39631dde 100644 +--- a/src/pip/_internal/index/package_finder.py ++++ b/src/pip/_internal/index/package_finder.py +@@ -863,6 +863,7 @@ def make_candidate_evaluator( + hashes=hashes, + ) + ++ @lru_cache(maxsize=None) + def find_best_candidate( + self, + project_name, # type: str +diff --git a/src/pip/_internal/utils/hashes.py b/src/pip/_internal/utils/hashes.py +index b306dafe7d..4d90f5bfda 100644 +--- a/src/pip/_internal/utils/hashes.py ++++ b/src/pip/_internal/utils/hashes.py +@@ -39,7 +39,12 @@ def __init__(self, hashes=None): + :param hashes: A dict of algorithm names pointing to lists of allowed + hex digests + """ +- self._allowed = {} if hashes is None else hashes ++ allowed = {} ++ if hashes is not None: ++ for alg, keys in hashes.items(): ++ # Make sure values are always sorted (to ease equality checks) ++ allowed[alg] = sorted(keys) ++ self._allowed = allowed + + def __and__(self, other): + # type: (Hashes) -> Hashes +@@ -128,6 +133,22 @@ def __bool__(self): + # type: () -> bool + return self.__nonzero__() + ++ def __eq__(self, other): ++ # type: (object) -> bool ++ if not isinstance(other, Hashes): ++ return NotImplemented ++ return self._allowed == other._allowed ++ ++ def __hash__(self): ++ # type: () -> int ++ return hash( ++ ",".join(sorted( ++ ":".join((alg, digest)) ++ for alg, digest_list in self._allowed.items() ++ for digest in digest_list ++ )) ++ ) ++ + + class MissingHashes(Hashes): + """A workalike for Hashes used when we're missing a hash for a requirement +diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py +index 14b4d74820..1996b35cb3 100644 +--- a/tests/unit/test_utils.py ++++ b/tests/unit/test_utils.py +@@ -541,6 +541,16 @@ def test_non_zero(self): + assert not Hashes() + assert not Hashes({}) + ++ def test_equality(self): ++ assert Hashes() == Hashes() ++ assert Hashes({'sha256': ['abcd']}) == Hashes({'sha256': ['abcd']}) ++ assert Hashes({'sha256': ['ab', 'cd']}) == Hashes({'sha256': ['cd', 'ab']}) ++ ++ def test_hash(self): ++ cache = {} ++ cache[Hashes({'sha256': ['ab', 'cd']})] = 42 ++ assert cache[Hashes({'sha256': ['ab', 'cd']})] == 42 ++ + + class TestEncoding(object): + """Tests for pip._internal.utils.encoding""" diff --git a/python-pip.spec b/python-pip.spec index 05f810a986da3034c3f240b38e74be80b2c67322..aa05cdfab3a20a418130dca86cd1496eff887949 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: 2e11f312d0072aa14ff744eafbfe9b32f09f190c.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 +* 20201101023007638760 patch-tracking 20.2.2-3 +- append patch file of upstream repository from <2e11f312d0072aa14ff744eafbfe9b32f09f190c> to <2e11f312d0072aa14ff744eafbfe9b32f09f190c> + * 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