From 3a8392ea365230371e6fff0f99a5ae14db06e56f Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Wed, 28 Oct 2020 21:30:11 +0800 Subject: [PATCH 1/2] [patch tracking] 20201028213007638385 - https://github.com/pypa/pip/commit/00e531a16e3079249b60d959328449fb1988ea8d --- ...31a16e3079249b60d959328449fb1988ea8d.patch | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 00e531a16e3079249b60d959328449fb1988ea8d.patch diff --git a/00e531a16e3079249b60d959328449fb1988ea8d.patch b/00e531a16e3079249b60d959328449fb1988ea8d.patch new file mode 100644 index 0000000..3ad3f37 --- /dev/null +++ b/00e531a16e3079249b60d959328449fb1988ea8d.patch @@ -0,0 +1,151 @@ +diff --git a/news/8975.feature.rst b/news/8975.feature.rst +new file mode 100644 +index 0000000000..082612505b +--- /dev/null ++++ b/news/8975.feature.rst +@@ -0,0 +1 @@ ++Log an informational message when backtracking takes multiple rounds on a specific package. +diff --git a/src/pip/_internal/resolution/resolvelib/reporter.py b/src/pip/_internal/resolution/resolvelib/reporter.py +new file mode 100644 +index 0000000000..65c4373731 +--- /dev/null ++++ b/src/pip/_internal/resolution/resolvelib/reporter.py +@@ -0,0 +1,52 @@ ++from collections import defaultdict ++from logging import getLogger ++ ++from pip._vendor.resolvelib.reporters import BaseReporter ++ ++from pip._internal.utils.typing import MYPY_CHECK_RUNNING ++ ++if MYPY_CHECK_RUNNING: ++ from typing import DefaultDict ++ ++ from .base import Candidate ++ ++ ++logger = getLogger(__name__) ++ ++ ++class PipReporter(BaseReporter): ++ ++ def __init__(self): ++ # type: () -> None ++ self.backtracks_by_package = defaultdict(int) # type: DefaultDict[str, int] ++ ++ self._messages_at_backtrack = { ++ 1: ( ++ "pip is looking at multiple versions of this package to determine " ++ "which version is compatible with other requirements. " ++ "This could take a while." ++ ), ++ 8: ( ++ "pip is looking at multiple versions of this package to determine " ++ "which version is compatible with other requirements. " ++ "This could take a while." ++ ), ++ 13: ( ++ "This is taking longer than usual. You might need to provide the " ++ "dependency resolver with stricter constraints to reduce runtime." ++ "If you want to abort this run, you can press Ctrl + C to do so." ++ "To improve how pip performs, tell us what happened here: " ++ "https://pip.pypa.io/surveys/backtracking" ++ ) ++ } ++ ++ def backtracking(self, candidate): ++ # type: (Candidate) -> None ++ self.backtracks_by_package[candidate.name] += 1 ++ ++ count = self.backtracks_by_package[candidate.name] ++ if count not in self._messages_at_backtrack: ++ return ++ ++ message = self._messages_at_backtrack[count] ++ logger.info("INFO: %s", message) +diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py +index 52f228bc60..65d0874121 100644 +--- a/src/pip/_internal/resolution/resolvelib/resolver.py ++++ b/src/pip/_internal/resolution/resolvelib/resolver.py +@@ -3,7 +3,7 @@ + + from pip._vendor import six + from pip._vendor.packaging.utils import canonicalize_name +-from pip._vendor.resolvelib import BaseReporter, ResolutionImpossible ++from pip._vendor.resolvelib import ResolutionImpossible + from pip._vendor.resolvelib import Resolver as RLResolver + + from pip._internal.exceptions import InstallationError +@@ -11,6 +11,7 @@ + from pip._internal.req.req_set import RequirementSet + from pip._internal.resolution.base import BaseResolver + from pip._internal.resolution.resolvelib.provider import PipProvider ++from pip._internal.resolution.resolvelib.reporter import PipReporter + from pip._internal.utils.misc import dist_is_editable + from pip._internal.utils.typing import MYPY_CHECK_RUNNING + +@@ -103,7 +104,7 @@ def resolve(self, root_reqs, check_supported_wheels): + upgrade_strategy=self.upgrade_strategy, + user_requested=user_requested, + ) +- reporter = BaseReporter() ++ reporter = PipReporter() + resolver = RLResolver(provider, reporter) + + try: +diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py +index 1718ab8a8b..91befb7f53 100644 +--- a/tests/functional/test_new_resolver.py ++++ b/tests/functional/test_new_resolver.py +@@ -1046,3 +1046,51 @@ def test_new_resolver_prefers_installed_in_upgrade_if_latest(script): + "pkg", + ) + assert_installed(script, pkg="2") ++ ++ ++@pytest.mark.parametrize("N", [2, 10, 20]) ++def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N): ++ # Generate a set of wheels that will definitely cause backtracking. ++ for index in range(1, N+1): ++ A_version = "{index}.0.0".format(index=index) ++ B_version = "{index}.0.0".format(index=index) ++ C_version = "{index_minus_one}.0.0".format(index_minus_one=index - 1) ++ ++ depends = ["B == " + B_version] ++ if index != 1: ++ depends.append("C == " + C_version) ++ ++ print("A", A_version, "B", B_version, "C", C_version) ++ create_basic_wheel_for_package(script, "A", A_version, depends=depends) ++ ++ for index in range(1, N+1): ++ B_version = "{index}.0.0".format(index=index) ++ C_version = "{index}.0.0".format(index=index) ++ depends = ["C == " + C_version] ++ ++ print("B", B_version, "C", C_version) ++ create_basic_wheel_for_package(script, "B", B_version, depends=depends) ++ ++ for index in range(1, N+1): ++ C_version = "{index}.0.0".format(index=index) ++ print("C", C_version) ++ create_basic_wheel_for_package(script, "C", C_version) ++ ++ # Install A ++ result = script.pip( ++ "install", ++ "--use-feature=2020-resolver", ++ "--no-cache-dir", ++ "--no-index", ++ "--find-links", script.scratch_path, ++ "A" ++ ) ++ ++ assert_installed(script, A="1.0.0", B="1.0.0", C="1.0.0") ++ # These numbers are hard-coded in the code. ++ if N >= 1: ++ assert "This could take a while." in result.stdout ++ if N >= 8: ++ assert result.stdout.count("This could take a while.") >= 2 ++ if N >= 13: ++ assert "press Ctrl + C" in result.stdout -- Gitee From 0197e90e154d0ae32b217cd682f32d205ec978a0 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Wed, 28 Oct 2020 21:30:12 +0800 Subject: [PATCH 2/2] [patch tracking] 20201028213007638385 - 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..d0cc959 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: 00e531a16e3079249b60d959328449fb1988ea8d.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 +* 20201028213007638385 patch-tracking 20.2.2-3 +- append patch file of upstream repository from <00e531a16e3079249b60d959328449fb1988ea8d> to <00e531a16e3079249b60d959328449fb1988ea8d> + * 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