From 0e4820e4e1fc5b9017ed4a58c83cc13f69f66d99 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Thu, 26 Nov 2020 18:30:12 +0800 Subject: [PATCH 1/2] [patch tracking] 20201126183007639649 - https://github.com/pypa/pip/commit/254414b012c047604ed7cb9868e64f5b6138e971 --- ...14b012c047604ed7cb9868e64f5b6138e971.patch | 262 ++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 254414b012c047604ed7cb9868e64f5b6138e971.patch diff --git a/254414b012c047604ed7cb9868e64f5b6138e971.patch b/254414b012c047604ed7cb9868e64f5b6138e971.patch new file mode 100644 index 0000000..c04e8da --- /dev/null +++ b/254414b012c047604ed7cb9868e64f5b6138e971.patch @@ -0,0 +1,262 @@ +diff --git a/src/pip/_internal/index/collector.py b/src/pip/_internal/index/collector.py +index 7b9abbf69e..b850b8cbed 100644 +--- a/src/pip/_internal/index/collector.py ++++ b/src/pip/_internal/index/collector.py +@@ -22,7 +22,7 @@ + from pip._internal.models.search_scope import SearchScope + from pip._internal.network.utils import raise_for_status + from pip._internal.utils.compat import lru_cache +-from pip._internal.utils.filetypes import ARCHIVE_EXTENSIONS ++from pip._internal.utils.filetypes import is_archive_file + from pip._internal.utils.misc import pairwise, redact_auth_from_url + from pip._internal.utils.typing import MYPY_CHECK_RUNNING + from pip._internal.utils.urls import path_to_url, url_to_path +@@ -65,17 +65,6 @@ def _match_vcs_scheme(url): + return None + + +-def _is_url_like_archive(url): +- # type: (str) -> bool +- """Return whether the URL looks like an archive. +- """ +- filename = Link(url).filename +- for bad_ext in ARCHIVE_EXTENSIONS: +- if filename.endswith(bad_ext): +- return True +- return False +- +- + class _NotHTML(Exception): + def __init__(self, content_type, request_desc): + # type: (str, str) -> None +@@ -130,7 +119,7 @@ def _get_html_response(url, session): + 3. Check the Content-Type header to make sure we got HTML, and raise + `_NotHTML` otherwise. + """ +- if _is_url_like_archive(url): ++ if is_archive_file(Link(url).filename): + _ensure_html_response(url, session=session) + + logger.debug('Getting page %s', redact_auth_from_url(url)) +diff --git a/src/pip/_internal/req/constructors.py b/src/pip/_internal/req/constructors.py +index 97420af6c2..2245cb826f 100644 +--- a/src/pip/_internal/req/constructors.py ++++ b/src/pip/_internal/req/constructors.py +@@ -24,8 +24,8 @@ + from pip._internal.pyproject import make_pyproject_path + from pip._internal.req.req_install import InstallRequirement + from pip._internal.utils.deprecation import deprecated +-from pip._internal.utils.filetypes import ARCHIVE_EXTENSIONS +-from pip._internal.utils.misc import is_installable_dir, splitext ++from pip._internal.utils.filetypes import is_archive_file ++from pip._internal.utils.misc import is_installable_dir + from pip._internal.utils.typing import MYPY_CHECK_RUNNING + from pip._internal.utils.urls import path_to_url + from pip._internal.vcs import is_url, vcs +@@ -45,15 +45,6 @@ + operators = Specifier._operators.keys() + + +-def is_archive_file(name): +- # type: (str) -> bool +- """Return True if `name` is a considered as an archive file.""" +- ext = splitext(name)[1].lower() +- if ext in ARCHIVE_EXTENSIONS: +- return True +- return False +- +- + def _strip_extras(path): + # type: (str) -> Tuple[str, Optional[str]] + m = re.match(r'^(.+)(\[[^\]]+\])$', path) +diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py +index e2e164d12c..9053c871d8 100644 +--- a/src/pip/_internal/resolution/resolvelib/resolver.py ++++ b/src/pip/_internal/resolution/resolvelib/resolver.py +@@ -16,6 +16,8 @@ + PipDebuggingReporter, + PipReporter, + ) ++from pip._internal.utils.deprecation import deprecated ++from pip._internal.utils.filetypes import is_archive_file + from pip._internal.utils.misc import dist_is_editable + from pip._internal.utils.typing import MYPY_CHECK_RUNNING + +@@ -132,12 +134,14 @@ def resolve(self, root_reqs, check_supported_wheels): + + # Check if there is already an installation under the same name, + # and set a flag for later stages to uninstall it, if needed. +- # * There isn't, good -- no uninstalltion needed. ++ # ++ # * There is no existing installation. Nothing to uninstall. + # * The --force-reinstall flag is set. Always reinstall. + # * The installation is different in version or editable-ness, so + # we need to uninstall it to install the new distribution. +- # * The installed version is the same as the pending distribution. +- # Skip this distrubiton altogether to save work. ++ # * The candidate is a local wheel. Do nothing. ++ # * The candidate is a local sdist. Print a deprecation warning. ++ # * The candidate is a local path. Always reinstall. + installed_dist = self.factory.get_dist_to_uninstall(candidate) + if installed_dist is None: + ireq.should_reinstall = False +@@ -147,6 +151,34 @@ def resolve(self, root_reqs, check_supported_wheels): + ireq.should_reinstall = True + elif dist_is_editable(installed_dist) != candidate.is_editable: + ireq.should_reinstall = True ++ elif candidate.source_link.is_file: ++ if candidate.source_link.is_wheel: ++ logger.info( ++ "%s is already installed with the same version as the " ++ "provided wheel. Use --force-reinstall to force an " ++ "installation of the wheel.", ++ ireq.name, ++ ) ++ continue ++ ++ looks_like_sdist = ( ++ is_archive_file(candidate.source_link.file_path) ++ and candidate.source_link.ext != ".zip" ++ ) ++ if looks_like_sdist: ++ reason = ( ++ "Source distribution is being reinstalled despite an " ++ "installed package having the same name and version as " ++ "the installed package." ++ ) ++ replacement = "use --force-reinstall" ++ deprecated( ++ reason=reason, ++ replacement=replacement, ++ gone_in="21.1", ++ issue=8711, ++ ) ++ ireq.should_reinstall = True + else: + continue + +diff --git a/src/pip/_internal/utils/filetypes.py b/src/pip/_internal/utils/filetypes.py +index daa0ca771b..201c6ebbed 100644 +--- a/src/pip/_internal/utils/filetypes.py ++++ b/src/pip/_internal/utils/filetypes.py +@@ -1,5 +1,6 @@ + """Filetype information. + """ ++from pip._internal.utils.misc import splitext + from pip._internal.utils.typing import MYPY_CHECK_RUNNING + + if MYPY_CHECK_RUNNING: +@@ -14,3 +15,12 @@ + ARCHIVE_EXTENSIONS = ( + ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS + ) ++ ++ ++def is_archive_file(name): ++ # type: (str) -> bool ++ """Return True if `name` is a considered as an archive file.""" ++ ext = splitext(name)[1].lower() ++ if ext in ARCHIVE_EXTENSIONS: ++ return True ++ return False +diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py +index 45e1a03470..b730b3cbdf 100644 +--- a/tests/functional/test_new_resolver.py ++++ b/tests/functional/test_new_resolver.py +@@ -1152,44 +1152,69 @@ def test_new_resolver_check_wheel_version_normalized( + assert_installed(script, simple="0.1.0+local.1") + + +-def test_new_resolver_contraint_on_dep_with_extra(script): +- create_basic_wheel_for_package( ++def test_new_resolver_does_reinstall_local_sdists(script): ++ archive_path = create_basic_sdist_for_package( + script, +- name="simple", +- version="1", +- depends=["dep[x]"], ++ "pkg", ++ "1.0", + ) +- create_basic_wheel_for_package( +- script, +- name="dep", +- version="1", +- extras={"x": ["depx==1"]}, ++ script.pip( ++ "install", "--no-cache-dir", "--no-index", ++ archive_path, + ) +- create_basic_wheel_for_package( +- script, +- name="dep", +- version="2", +- extras={"x": ["depx==2"]}, ++ assert_installed(script, pkg="1.0") ++ ++ result = script.pip( ++ "install", "--no-cache-dir", "--no-index", ++ archive_path, ++ expect_stderr=True, + ) +- create_basic_wheel_for_package( ++ assert "Installing collected packages: pkg" in result.stdout, str(result) ++ assert "DEPRECATION" in result.stderr, str(result) ++ assert_installed(script, pkg="1.0") ++ ++ ++def test_new_resolver_does_reinstall_local_paths(script): ++ pkg = create_test_package_with_setup( + script, +- name="depx", +- version="1", ++ name="pkg", ++ version="1.0" + ) +- create_basic_wheel_for_package( +- script, +- name="depx", +- version="2", ++ script.pip( ++ "install", "--no-cache-dir", "--no-index", ++ pkg, + ) ++ assert_installed(script, pkg="1.0") ++ ++ result = script.pip( ++ "install", "--no-cache-dir", "--no-index", ++ pkg, ++ ) ++ assert "Installing collected packages: pkg" in result.stdout, str(result) ++ assert_installed(script, pkg="1.0") + +- constraints_txt = script.scratch_path / "constraints.txt" +- constraints_txt.write_text("dep==1") + ++def test_new_resolver_does_not_reinstall_when_from_a_local_index(script): ++ create_basic_sdist_for_package( ++ script, ++ "simple", ++ "0.1.0", ++ ) + script.pip( + "install", + "--no-cache-dir", "--no-index", + "--find-links", script.scratch_path, +- "--constraint", constraints_txt, +- "simple", ++ "simple" ++ ) ++ assert_installed(script, simple="0.1.0") ++ ++ result = script.pip( ++ "install", ++ "--no-cache-dir", "--no-index", ++ "--find-links", script.scratch_path, ++ "simple" + ) +- assert_installed(script, simple="1", dep="1", depx="1") ++ # Should not reinstall! ++ assert "Installing collected packages: simple" not in result.stdout, str(result) ++ assert "Requirement already satisfied: simple" in result.stdout, str(result) ++ assert_installed(script, simple="0.1.0") -- Gitee From 20fd882af6ff740939bd897918eaf3d8310964fb Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Thu, 26 Nov 2020 18:30:13 +0800 Subject: [PATCH 2/2] [patch tracking] 20201126183007639649 - 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..9bf09e1 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: 254414b012c047604ed7cb9868e64f5b6138e971.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 +* 20201126183007639649 patch-tracking 20.2.2-4 +- append patch file of upstream repository from <254414b012c047604ed7cb9868e64f5b6138e971> to <254414b012c047604ed7cb9868e64f5b6138e971> + * 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