From 697613136f02e14d2695027c7958808659f9f5bb Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Thu, 3 Dec 2020 21:58:54 +0800 Subject: [PATCH 1/2] [patch tracking] 20201203215849755722 - https://github.com/pypa/pip/commit/ab7ff0a1b50dadfe8da1fe44ee115440b844426c --- ...f0a1b50dadfe8da1fe44ee115440b844426c.patch | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 ab7ff0a1b50dadfe8da1fe44ee115440b844426c.patch diff --git a/ab7ff0a1b50dadfe8da1fe44ee115440b844426c.patch b/ab7ff0a1b50dadfe8da1fe44ee115440b844426c.patch new file mode 100644 index 0000000..720ce74 --- /dev/null +++ b/ab7ff0a1b50dadfe8da1fe44ee115440b844426c.patch @@ -0,0 +1,72 @@ +diff --git a/news/9185.feature.rst b/news/9185.feature.rst +new file mode 100644 +index 0000000000..a9d9ae7187 +--- /dev/null ++++ b/news/9185.feature.rst +@@ -0,0 +1,2 @@ ++New resolver: Resolve direct and pinned (``==`` or ``===``) requirements first ++to improve resolver performance. +diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py +index c0e6b60d90..c91f252f7b 100644 +--- a/src/pip/_internal/resolution/resolvelib/provider.py ++++ b/src/pip/_internal/resolution/resolvelib/provider.py +@@ -56,9 +56,58 @@ def get_preference( + information # type: Sequence[Tuple[Requirement, Candidate]] + ): + # type: (...) -> Any ++ """Produce a sort key for given requirement based on preference. ++ ++ The lower the return value is, the more preferred this group of ++ arguments is. ++ ++ Currently pip considers the followings in order: ++ ++ * Prefer if any of the known requirements points to an explicit URL. ++ * If equal, prefer if any requirements contain ``===`` and ``==``. ++ * If equal, prefer if requirements include version constraints, e.g. ++ ``>=`` and ``<``. ++ * If equal, prefer user-specified (non-transitive) requirements. ++ * If equal, order alphabetically for consistency (helps debuggability). ++ """ ++ ++ def _get_restrictive_rating(requirements): ++ # type: (Iterable[Requirement]) -> int ++ """Rate how restrictive a set of requirements are. ++ ++ ``Requirement.get_candidate_lookup()`` returns a 2-tuple for ++ lookup. The first element is ``Optional[Candidate]`` and the ++ second ``Optional[InstallRequirement]``. ++ ++ * If the requirement is an explicit one, the explicitly-required ++ candidate is returned as the first element. ++ * If the requirement is based on a PEP 508 specifier, the backing ++ ``InstallRequirement`` is returned as the second element. ++ ++ We use the first element to check whether there is an explicit ++ requirement, and the second for equality operator. ++ """ ++ lookups = (r.get_candidate_lookup() for r in requirements) ++ cands, ireqs = zip(*lookups) ++ if any(cand is not None for cand in cands): ++ return 0 ++ spec_sets = (ireq.specifier for ireq in ireqs if ireq) ++ operators = [ ++ specifier.operator ++ for spec_set in spec_sets ++ for specifier in spec_set ++ ] ++ if any(op in ("==", "===") for op in operators): ++ return 1 ++ if operators: ++ return 2 ++ # A "bare" requirement without any version requirements. ++ return 3 ++ ++ restrictive = _get_restrictive_rating(req for req, _ in information) + transitive = all(parent is not None for _, parent in information) + key = next(iter(candidates)).name if candidates else "" +- return (transitive, key) ++ return (restrictive, transitive, key) + + def find_matches(self, requirements): + # type: (Sequence[Requirement]) -> Iterable[Candidate] -- Gitee From c0628b045bf1a485c87a8ef930709e3cc57ec4a1 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Thu, 3 Dec 2020 21:58:55 +0800 Subject: [PATCH 2/2] [patch tracking] 20201203215849755722 - 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..156f4c0 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: ab7ff0a1b50dadfe8da1fe44ee115440b844426c.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 +* 20201203215849755722 patch-tracking 20.2.2-4 +- append patch file of upstream repository from to + * 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