Update to 20.0.2

Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1793456

The main() wrapper moved the import path again, this time with compatibility shim:

 - we still need pip-allow-different-versions.patch to support older pips installed by users
 - we dropped callable-main.patch - the shim is provided by pip for all previous paths
 - no need to patch older pips to support user installed pip 20+
 - no need to patch Pythons (or virtualenv) to support pip 20+ wheel in ensurepip
This commit is contained in:
Miro Hrončok 2020-03-04 12:20:06 +01:00
parent c9ae810483
commit f994ff1cc7
8 changed files with 68 additions and 1208 deletions

49
.gitignore vendored
View File

@ -1,42 +1,7 @@
pip-0.7.2.tar.gz
/pip-0.8.tar.gz
/pip-0.8.2.tar.gz
/pip-0.8.3.tar.gz
/pip-1.0.2.tar.gz
/pip-1.1.tar.gz
/pip-1.3.1.tar.gz
/pip-1.4.1.tar.gz
/pip-1.5.4.tar.gz
/pip-1.5.6.tar.gz
/pip-1.5.6-tests.tar.gz
/pip-6.0.8.tar.gz
/pip-7.0.3.tar.gz
/pip-7.1.0.tar.gz
/pip-7.1.0-tests.tar.gz
/pip-8.0.2.tar.gz
/pip-8.1.2.tar.gz
/pip-8.1.2-tests.tar.gz
/pip-9.0.1.tar.gz
/pip-9.0.1-tests.tar.gz
/pip-9.0.3.tar.gz
/pip-9.0.3-tests.tar.gz
/pip-10.0.1.tar.gz
/pip-18.0.tar.gz
/d2e63fbfc62af3b7050f619b2f5bb8658985b931.zip
/2018.2.tar.gz
/pip-18.0-tests.tar.gz
/d2e63fbfc62af3b7050f619b2f5bb8658985b931.tar.gz
/pip-18.1.tar.gz
/pip-18.1-tests.tar.gz
/pip-19.0.2.tar.gz
/pip-19.0.2-tests.tar.gz
/pip-19.0.3.tar.gz
/pip-19.0.3-tests.tar.gz
/pip-19.1.tar.gz
/pip-19.1-tests.tar.gz
/pip-19.1.1.tar.gz
/pip-19.1.1-tests.tar.gz
/pip-19.2.3.tar.gz
/pip-19.2.3-tests.tar.gz
/pip-19.3.1.tar.gz
/pip-19.3.1-tests.tar.gz
/*.tar.gz
/*.zip
/pip-*/
/pip/
/results_python-pip/
*.rpm

View File

@ -1,43 +0,0 @@
diff --git a/src/pip/_internal/__init__.py b/src/pip/_internal/__init__.py
index 8c0e4c58..76e280e5 100755
--- a/src/pip/_internal/__init__.py
+++ b/src/pip/_internal/__init__.py
@@ -1,2 +1,3 @@
#!/usr/bin/env python
import pip._internal.utils.inject_securetransport # noqa
+from pip._internal import main # noqa
diff --git a/src/pip/_internal/main.py b/src/pip/_internal/main.py
index 1e922402..d3df58b3 100644
--- a/src/pip/_internal/main.py
+++ b/src/pip/_internal/main.py
@@ -45,3 +45,30 @@ def main(args=None):
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
return command.main(cmd_args)
+
+
+# Dark magic to make the main module itself callable.
+# This is needed to be able to use this pip in ensurepip of older Pythons
+# without patching all the Pythons.
+
+# In Python 3.5+, we can just inherit, define __call__ and override
+# sys.modules[__name__].__class__, however, that is not possible in 2.7.
+
+class _CallableModule(type(sys.modules[__name__])):
+ def __init__(self):
+ super(_CallableModule, self).__init__(__name__)
+ self._main = sys.modules[__name__]
+ sys.modules[__name__] = self
+ self.__doc__ = self._main.__doc__
+
+ def __call__(self, *args, **kwargs):
+ return main(*args, **kwargs)
+
+ def __dir__(self):
+ return dir(self._main)
+
+ def __getattr__(self, attr):
+ return getattr(self._main, attr)
+
+
+_CallableModule()

View File

@ -10,19 +10,19 @@ Issue upstream: https://github.com/pypa/pip/issues/4288
1 file changed, 19 insertions(+)
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
index 5842d18..a6104b4 100644
index 02a187c..8037ffb 100644
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -12,6 +12,8 @@ import logging
import operator
@@ -13,6 +13,8 @@ import operator
import os
import shutil
import site
+import sys
+from os import path
from optparse import SUPPRESS_HELP
from pip._vendor import pkg_resources
@@ -281,6 +283,23 @@ class InstallCommand(RequirementCommand):
@@ -242,6 +244,23 @@ class InstallCommand(RequirementCommand):
def run(self, options, args):
# type: (Values, List[Any]) -> int
cmdoptions.check_install_build_global(options)

View File

@ -1,22 +1,26 @@
--- /usr/bin/pip3 2019-11-12 17:37:34.793131862 +0100
+++ pip3 2019-11-12 17:40:42.014107134 +0100
@@ -2,7 +2,19 @@
@@ -2,7 +2,23 @@
# -*- coding: utf-8 -*-
import re
import sys
-from pip._internal.main import main
-from pip._internal.cli.main import main
+
+try:
+ from pip._internal.main import main
+ from pip._internal.cli.main import main
+except ImportError:
+ try:
+ # If the user has downgraded pip, the above import will fail.
+ # Let's try older methods of invoking it:
+
+ # pip 19 uses this
+ from pip._internal import main
+ from pip._internal.main import main
+ except ImportError:
+ # older pip versions use this
+ from pip import main
+ try:
+ # If the user has downgraded pip, the above import will fail.
+ # Let's try older methods of invoking it:
+
+ # pip 19 uses this
+ from pip._internal import main
+ except ImportError:
+ # older pip versions use this
+ from pip import main
+
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])

View File

@ -15,8 +15,8 @@
Name: python-%{srcname}
# When updating, update the bundled libraries versions bellow!
# You can use vendor_meta.sh in the dist git repo
Version: 19.3.1
Release: 2%{?dist}
Version: 20.0.2
Release: 1%{?dist}
Summary: A tool for installing and managing Python packages
# We bundle a lot of libraries with pip, which itself is under MIT license.
@ -91,21 +91,6 @@ Patch3: remove-existing-dist-only-if-path-conflicts.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1655253
Patch4: dummy-certifi.patch
%if %{with tests}
# Mark tests that need the Internet as network tests so we can skip them
# https://github.com/pypa/pip/pull/7359
Patch5: network-tests.patch
%endif
# Dark magic to make pip 19.3+ support the old private API of main()
# This is needed to be able to use pip 19.3+ in ensurepip of older Pythons
# without patching all the Pythons
# A proper fix is discussed in:
# https://discuss.python.org/t/can-we-finally-add-a-minimal-api-to-pip/2833/3
# https://github.com/pypa/pip/pull/7061
# https://github.com/python/cpython/pull/16782
Patch6: callable-main.patch
# Downstream only patch
# Users might have local installations of pip from using
# `pip install --user --upgrade pip` on older/newer versions.
@ -123,6 +108,10 @@ Patch6: callable-main.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1767212
# WARNING: /usr/bin/pip* are entrypoints, this cannot be applied in %%prep!
# %%patch10 doesn't work outside of %%prep, so we add it as a source
# Note that since pip 20, old main() import paths are preserved for backwards
# compatibility: https://github.com/pypa/pip/issues/7498
# Meaning we don't need to update any of the older pips to support 20+
# We also don't need to update Pythons to use new import path in ensurepip
Source10: pip-allow-different-versions.patch
%description
@ -137,27 +126,27 @@ Packages" or "Pip Installs Python".
# You can find the versions in src/pip/_vendor/vendor.txt file.
%global bundled() %{expand:
Provides: bundled(python%{1}dist(appdirs)) = 1.4.3
Provides: bundled(python%{1}dist(CacheControl)) = 0.12.5
Provides: bundled(python%{1}dist(certifi)) = 2019.9.11
Provides: bundled(python%{1}dist(CacheControl)) = 0.12.6
Provides: bundled(python%{1}dist(certifi)) = 2019.11.28
Provides: bundled(python%{1}dist(chardet)) = 3.0.4
Provides: bundled(python%{1}dist(colorama)) = 0.4.1
Provides: bundled(python%{1}dist(colorama)) = 0.4.3
Provides: bundled(python%{1}dist(contextlib2)) = 0.6.0
Provides: bundled(python%{1}dist(distlib)) = 0.2.9.post0
Provides: bundled(python%{1}dist(distlib)) = 0.3.0
Provides: bundled(python%{1}dist(distro)) = 1.4.0
Provides: bundled(python%{1}dist(html5lib)) = 1.0.1
Provides: bundled(python%{1}dist(idna)) = 2.8
Provides: bundled(python%{1}dist(ipaddress)) = 1.0.22
Provides: bundled(python%{1}dist(ipaddress)) = 1.0.23
Provides: bundled(python%{1}dist(msgpack)) = 0.6.2
Provides: bundled(python%{1}dist(packaging)) = 19.2
Provides: bundled(python%{1}dist(packaging)) = 20.1
Provides: bundled(python%{1}dist(pep517)) = 0.7.0
Provides: bundled(python%{1}dist(progress)) = 1.5
Provides: bundled(python%{1}dist(pyparsing)) = 2.4.2
Provides: bundled(python%{1}dist(pyparsing)) = 2.4.6
Provides: bundled(python%{1}dist(pytoml)) = 0.1.21
Provides: bundled(python%{1}dist(requests)) = 2.22.0
Provides: bundled(python%{1}dist(retrying)) = 1.3.3
Provides: bundled(python%{1}dist(setuptools)) = 41.4.0
Provides: bundled(python%{1}dist(six)) = 1.12.0
Provides: bundled(python%{1}dist(urllib3)) = 1.25.6
Provides: bundled(python%{1}dist(setuptools)) = 44.0.0
Provides: bundled(python%{1}dist(six)) = 1.14.0
Provides: bundled(python%{1}dist(urllib3)) = 1.25.7
Provides: bundled(python%{1}dist(webencodings)) = 0.5.1
}
@ -195,6 +184,7 @@ BuildRequires: python%{python3_pkgversion}-pretend
BuildRequires: python%{python3_pkgversion}-freezegun
BuildRequires: python%{python3_pkgversion}-scripttest
BuildRequires: python%{python3_pkgversion}-virtualenv
BuildRequires: python%{python3_pkgversion}-werkzeug
BuildRequires: python%{python3_pkgversion}-pyyaml
%endif
BuildRequires: python%{python3_pkgversion}-wheel
@ -260,10 +250,6 @@ popd
%patch2 -p1
%patch3 -p1
%patch4 -p1
%if %{with tests}
%patch5 -p1
%endif
%patch6 -p1
# this goes together with patch4
rm src/pip/_vendor/certifi/*.pem
@ -331,7 +317,7 @@ ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3
# Make sure the INSTALLER is not pip, otherwise Patch2 won't work
# TODO Maybe we should make all our python packages have this?
# %%pyproject macros do this for all packages
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
mkdir -p %{buildroot}%{python_wheeldir}
@ -392,6 +378,9 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
%{python_wheeldir}/%{python_wheelname}
%changelog
* Mon Mar 02 2020 Miro Hrončok <mhroncok@redhat.com> - 20.0.2-1
- Update to 20.0.2 (#1793456)
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 19.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

View File

@ -1,4 +1,4 @@
From 8c58a99221415ca7c3d5ce50dcffefa14e421928 Mon Sep 17 00:00:00 2001
From b46ec3663c0535fc40503fe9a78b1b7733281bdf Mon Sep 17 00:00:00 2001
From: Tomas Orsava <torsava@redhat.com>
Date: Tue, 12 Nov 2019 17:24:20 +0100
Subject: [PATCH] Subject: Prevent removing of the system packages installed
@ -17,18 +17,18 @@ Co-Authored-By: Victor Stinner <vstinner@redhat.com>
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/pip/_internal/legacy_resolve.py b/src/pip/_internal/legacy_resolve.py
index c24158f..bd92287 100644
index ca269121..e8d939bf 100644
--- a/src/pip/_internal/legacy_resolve.py
+++ b/src/pip/_internal/legacy_resolve.py
@@ -30,6 +30,7 @@ from pip._internal.exceptions import (
)
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
+ dist_in_install_path,
dist_in_usersite,
ensure_dir,
normalize_version_info,
@@ -224,7 +225,9 @@ class Resolver(object):
from pip._internal.utils.misc import dist_in_usersite, normalize_version_info
+from pip._internal.utils.misc import dist_in_install_path
from pip._internal.utils.packaging import (
check_requires_python,
get_requires_python,
@@ -199,7 +200,9 @@ class Resolver(object):
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
@ -36,35 +36,35 @@ index c24158f..bd92287 100644
+ if ((not self.use_user_site
+ or dist_in_usersite(req.satisfied_by))
+ and dist_in_install_path(req.satisfied_by)):
req.conflicts_with = req.satisfied_by
req.should_reinstall = True
req.satisfied_by = None
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 5a8c0dc..f80ba87 100644
index 22ac24b9..8a461b95 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -39,6 +39,7 @@ from pip._internal.utils.misc import (
@@ -42,6 +42,7 @@ from pip._internal.utils.misc import (
ask_path_exists,
backup_dir,
display_path,
+ dist_in_install_path,
dist_in_site_packages,
dist_in_usersite,
ensure_dir,
@@ -461,7 +462,7 @@ class InstallRequirement(object):
get_installed_version,
@@ -457,7 +458,7 @@ class InstallRequirement(object):
"lack sys.path precedence to %s in %s" %
(existing_dist.project_name, existing_dist.location)
)
- else:
+ elif dist_in_install_path(existing_dist):
self.conflicts_with = existing_dist
return True
self.should_reinstall = True
else:
if self.editable and self.satisfied_by:
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
index b848263..5b75fed 100644
index 4a581601..2617ad33 100644
--- a/src/pip/_internal/utils/misc.py
+++ b/src/pip/_internal/utils/misc.py
@@ -28,6 +28,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
@@ -29,6 +29,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
from pip import __version__
from pip._internal.exceptions import CommandError
from pip._internal.locations import (
@ -72,7 +72,7 @@ index b848263..5b75fed 100644
get_major_minor_version,
site_packages,
user_site,
@@ -389,6 +390,16 @@ def dist_in_site_packages(dist):
@@ -385,6 +386,16 @@ def dist_in_site_packages(dist):
return dist_location(dist).startswith(normalize_path(site_packages))
@ -90,5 +90,5 @@ index b848263..5b75fed 100644
# type: (Distribution) -> bool
"""
--
2.20.1
2.24.1

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
SHA512 (pip-19.3.1.tar.gz) = 954b390580e23d0a85d1fa4cbd2f35171df7930fbe346f9a809477fe133e95f7d30208d79b5d07f30c81ab1b0a9b52f36f3ff6c77dc81a1c9ab9beb2bd8e0aa1
SHA512 (pip-19.3.1-tests.tar.gz) = fb058fcaaff3325341af5f4746be0c7943953c43fb721124758320363532911ca399f254a58e347c72795adc41764600bc6d02efce0e1e27d4b6d130efad9945
SHA512 (pip-20.0.2.tar.gz) = 72f9c4b8a5a3c5f8074bc2b671a118942f161fb145c38077ded8a18f07537eb674c679fdcf7c3f3f0aeee11d66fe34eaa157f53f1f689fce3e12567e5339ac89
SHA512 (pip-20.0.2-tests.tar.gz) = ac6eb7c4814b61138741306661f050ed5232ed4e402978b0c05045bbbdc6cddf476340ba3438e4668716d9b3093932ef82d1e7a778c43ab5934ed003bace03cb
SHA512 (d2e63fbfc62af3b7050f619b2f5bb8658985b931.tar.gz) = fc7b11c5cbf6322469ce2eaca2a8d7eb60b17398d316f7465ab5d3d38dabd00ee22a3da7437a28f6312f0115f77f2df0d8bf0abc671e055eef06356c94283409
SHA512 (2018.2.tar.gz) = 4c09c43a70ecb3ca3bc9445b01bf209eb382e41d9c969145696dea38551992ed88fd9b725a1264380f3dbdf8acdaf5ada3ef86b44255cdfbdbe4a01a1630912d