diff --git a/allow-stripping-given-prefix-from-wheel-RECORD-files.patch b/allow-stripping-given-prefix-from-wheel-RECORD-files.patch new file mode 100644 index 0000000000000000000000000000000000000000..d3aa35f488f7cb21c314529440197151a6778227 --- /dev/null +++ b/allow-stripping-given-prefix-from-wheel-RECORD-files.patch @@ -0,0 +1,31 @@ +From e2126b5d4efdbddb15a3c354110055f40d78f4cc Mon Sep 17 00:00:00 2001 +From: wwx930846 +Date: Mon, 24 Aug 2020 22:01:50 +0800 +Subject: [PATCH] allow-stripping-given-prefix-from-wheel-RECORD-files + +--- + src/pip/_internal/commands/install.py | 8 ++++++++ + src/pip/_internal/req/req_install.py | 4 +++- + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py +index 8c2c32f..674d30c 100644 +--- a/src/pip/_internal/commands/install.py ++++ b/src/pip/_internal/commands/install.py +@@ -130,6 +130,13 @@ class InstallCommand(RequirementCommand): + default=None, + help="Installation prefix where lib, bin and other top-level " + "folders are placed") ++ self.cmd_opts.add_option( ++ '--strip-file-prefix', ++ dest='strip_file_prefix', ++ metavar='prefix', ++ default=None, ++ help="Strip given prefix from script paths in wheel RECORD." ++ ) + + self.cmd_opts.add_option(cmdoptions.build_dir()) + + +2.23.0 + diff --git a/dummy-certifi.patch b/dummy-certifi.patch index 7c864fc99b29568cea667c13f343adb940eca8b1..f45f5b1aacbd95023edc82727df18e0cf72e05a0 100644 --- a/dummy-certifi.patch +++ b/dummy-certifi.patch @@ -8,20 +8,20 @@ Subject: [PATCH] Dummy certifi patch 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py -index 56b52a3c..e99043f0 100644 +index 8987449..128fa92 100644 --- a/src/pip/_vendor/certifi/core.py +++ b/src/pip/_vendor/certifi/core.py -@@ -21,9 +21,7 @@ except ImportError: +@@ -51,9 +51,7 @@ except ImportError: + # If we don't have importlib.resources, then we will just do the old logic + # of assuming we're on the filesystem and munge the path directly. + def where(): +- f = os.path.dirname(__file__) +- +- return os.path.join(f, "cacert.pem") ++ return '/etc/pki/tls/certs/ca-bundle.crt' - def where(): -- f = os.path.dirname(__file__) -- -- return os.path.join(f, "cacert.pem") -+ return '/etc/pki/tls/certs/ca-bundle.crt' - - def contents(): --- +-- 2.23.0 diff --git a/pip-20.1.1.tar.gz b/pip-20.1.1.tar.gz deleted file mode 100644 index 6647fb3592dfada65c3298189dbc2044623c4896..0000000000000000000000000000000000000000 Binary files a/pip-20.1.1.tar.gz and /dev/null differ diff --git a/pip-20.2.2.tar.gz b/pip-20.2.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..df4b2c067082ea8c629cf6c7105e5b98a1349894 Binary files /dev/null and b/pip-20.2.2.tar.gz differ diff --git a/pip-allow-different-versions.patch b/pip-allow-different-versions.patch deleted file mode 100644 index 4a1151743787811004ff3c6314013d7392d9bc2d..0000000000000000000000000000000000000000 --- a/pip-allow-different-versions.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- /usr/bin/pip3 2019-11-12 17:37:34.793131862 +0100 -+++ pip3 2019-11-12 17:40:42.014107134 +0100 -@@ -2,7 +2,23 @@ - # -*- coding: utf-8 -*- - import re - import sys --from pip._internal.cli.main import main -+ -+try: -+ from pip._internal.cli.main import main -+except ImportError: -+ try: -+ from pip._internal.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 -+ 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]) - sys.exit(main()) diff --git a/python-pip.spec b/python-pip.spec index d187805ab9fe1e702dd77731a9e2fd5f64d07191..8787d0dd318c22e6841004842758c5676beb24b8 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -6,20 +6,28 @@ pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes. %global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d}) Name: python-%{srcname} -Version: 20.1.1 +Version: 20.2.2 Release: 1 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 Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz BuildArch: noarch -Patch1: emit-a-warning-when-running-with-root-privileges.patch -Patch2: remove-existing-dist-only-if-path-conflicts.patch -Patch3: dummy-certifi.patch -Source1: pip-allow-different-versions.patch +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 %description %{_description} +%package -n python2-%{srcname} +Summary: %{summary} +BuildRequires: python2-devel python2-setuptools ca-certificates +Requires: python2-setuptools ca-certificates +BuildRequires: python2-pip python2-wheel +%{?python_provide:%python_provide python2-%{srcname}} +%description -n python2-%{srcname} %{_description} + %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-setuptools bash-completion ca-certificates @@ -40,13 +48,8 @@ A Python wheel of pip to use with venv %prep %autosetup -n %{srcname}-%{version} -p1 -# this goes together with patch4 -rm src/pip/_vendor/certifi/*.pem - -# tests expect wheels in here -ln -s %{python_wheeldir} tests/data/common_wheels -sed -i -e 's/csv23/csv/g' tests/lib/wheel.py %build +%py2_build %py3_build_wheel %install @@ -59,37 +62,69 @@ sed -i -e 's/csv23/csv/g' tests/lib/wheel.py --find-links dist \ 'pip==%{version}' +rm %{buildroot}%{_bindir}/pip -for PIP in %{buildroot}%{_bindir}/pip*; do - patch -p1 $PIP < %{SOURCE1} -done +%{__python2} dist/%{python_wheelname}/pip install \ + --root %{buildroot} \ + --no-deps \ + --no-cache-dir \ + --no-index \ + --ignore-installed \ + --find-links dist \ + 'pip==%{version}' +%if %{with doc} +pushd docs/build/man +install -d %{buildroot}%{_mandir}/man1 +for MAN in *1; do +install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN +for pip in "pip3" "pip-3" "pip%{python3_version}" "pip-%{python3_version}"; do +echo ".so $MAN" > %{buildroot}%{_mandir}/man1/${MAN/pip/$pip} +done +done +popd +%endif + +# before we ln -s anything, we apply Source10 patch to all pips: +#for PIP in %{buildroot}%{_bindir}/pip*; do +#% patch -p1 --no-backup-if-mismatch $PIP < %{SOURCE10} +#done + mkdir -p %{buildroot}%{bashcompdir} - PYTHONPATH=%{buildroot}%{python3_sitelib} \ %{buildroot}%{_bindir}/pip completion --bash \ > %{buildroot}%{bashcompdir}/pip3 - + +# Make bash completion apply to all the 5 symlinks we install sed -i -e "s/^\\(complete.*\\) pip\$/\\1 pip pip{,-}{3,%{python3_version}}/" \ -e s/_pip_completion/_pip3_completion/ \ %{buildroot}%{bashcompdir}/pip3 - - + +# Provide symlinks to executables to comply with Fedora guidelines for Python ln -s ./pip%{python3_version} %{buildroot}%{_bindir}/pip-%{python3_version} ln -s ./pip-%{python3_version} %{buildroot}%{_bindir}/pip-3 - -echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER - + +# Make sure the INSTALLER is not pip, otherwise Patch2 won't work +# %%pyproject macros do this for all packages +echo rpm > %{buildroot}%{python3_sitelib}/pip-20.2.2.dist-info/INSTALLER + mkdir -p %{buildroot}%{python_wheeldir} install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} + +%files -n python2-%{srcname} +%license LICENSE.txt +%{_bindir}/pip +%{_bindir}/pip2 +%{_bindir}/pip%{python2_version} +%{python2_sitelib}/pip* +%dir %{bashcompdir} +%dir %(dirname %{bashcompdir}) %files -n python%{python3_pkgversion}-%{srcname} %license LICENSE.txt -%{_bindir}/pip %{_bindir}/pip3 -%{_bindir}/pip-3 +%{_bindir}/pip-3* %{_bindir}/pip%{python3_version} -%{_bindir}/pip-%{python3_version} %{python3_sitelib}/pip* %dir %{bashcompdir} %{bashcompdir}/pip3* @@ -104,6 +139,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %{python_wheeldir}/%{python_wheelname} %changelog +* Tue Aug 25 2020 wenzhanli - 20.2.2-1 +- update to 20.2.2 and add python2 require + * Tue Jul 28 2020 jinzhimin - 20.1.1-1 - update to 20.1.1 diff --git a/remove-existing-dist-only-if-path-conflicts.patch b/remove-existing-dist-only-if-path-conflicts.patch index ff32533e99bed6c06374d7f7f5d83f706abc0740..99171ecaa935c6ee1cb11451e139d3f20f6ab55b 100644 --- a/remove-existing-dist-only-if-path-conflicts.patch +++ b/remove-existing-dist-only-if-path-conflicts.patch @@ -8,27 +8,25 @@ when pip install -U is executed. Resolves: rhbz#1550368 -Co-Authored-By: Michal Cyprian -Co-Authored-By: Victor Stinner --- - src/pip/_internal/req/req_install.py | 3 ++- - src/pip/_internal/resolution/legacy/resolver.py | 5 ++++- - src/pip/_internal/utils/misc.py | 11 +++++++++++ - 3 files changed, 17 insertions(+), 2 deletions(-) + src/pip/_internal/req/req_install.py | 3 ++- + src/pip/_internal/resolution/legacy/resolver.py | 5 ++++- + src/pip/_internal/utils/misc.py | 9 +++++++++ + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py -index 3b28209b..d14217e9 100644 +index 4759f4a..2e76e35 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py -@@ -38,6 +38,7 @@ from pip._internal.utils.misc import ( +@@ -39,6 +39,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, - get_installed_version, -@@ -444,7 +445,7 @@ class InstallRequirement(object): + get_distribution, +@@ -446,7 +447,7 @@ class InstallRequirement(object): "lack sys.path precedence to {} in {}".format( existing_dist.project_name, existing_dist.location) ) @@ -36,12 +34,12 @@ index 3b28209b..d14217e9 100644 + elif dist_in_install_path(existing_dist): self.should_reinstall = True else: - if self.editable and self.satisfied_by: + if self.editable: diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py -index cdb44d19..52e122c6 100644 +index c9b4c66..8b98ebd 100644 --- a/src/pip/_internal/resolution/legacy/resolver.py +++ b/src/pip/_internal/resolution/legacy/resolver.py -@@ -33,6 +33,7 @@ from pip._internal.resolution.base import BaseResolver +@@ -34,6 +34,7 @@ from pip._internal.resolution.base import BaseResolver from pip._internal.utils.compatibility_tags import get_supported from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import dist_in_usersite, normalize_version_info @@ -49,22 +47,22 @@ index cdb44d19..52e122c6 100644 from pip._internal.utils.packaging import ( check_requires_python, get_requires_python, -@@ -203,7 +204,9 @@ class Resolver(BaseResolver): +@@ -207,7 +208,9 @@ class Resolver(BaseResolver): """ # Don't uninstall the conflict if doing a user install and the # conflict is not a user install. - if not self.use_user_site or dist_in_usersite(req.satisfied_by): + if ((not self.use_user_site -+ or dist_in_usersite(req.satisfied_by)) -+ and dist_in_install_path(req.satisfied_by)): ++ or dist_in_usersite(req.satisfied_by)) ++ and dist_in_install_path(req.satisfied_by)): req.should_reinstall = True req.satisfied_by = None diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py -index 09031825..3c064f8f 100644 +index 5629c60..6bd6daa 100644 --- a/src/pip/_internal/utils/misc.py +++ b/src/pip/_internal/utils/misc.py -@@ -29,6 +29,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote +@@ -31,6 +31,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,10 +70,10 @@ index 09031825..3c064f8f 100644 get_major_minor_version, site_packages, user_site, -@@ -400,6 +401,16 @@ def dist_in_site_packages(dist): +@@ -402,6 +403,14 @@ def dist_in_site_packages(dist): + """ return dist_location(dist).startswith(normalize_path(site_packages)) - +def dist_in_install_path(dist): + """ + Return True if given Distribution is installed in @@ -84,12 +82,9 @@ index 09031825..3c064f8f 100644 + norm_path = normalize_path(dist_location(dist)) + return norm_path.startswith(normalize_path( + distutils_scheme("")['purelib'].split('python')[0])) -+ -+ + def dist_is_editable(dist): # type: (Distribution) -> bool - """ -- 2.23.0 -