update and add python require

This commit is contained in:
zhanliwen 2020-08-25 11:47:20 +08:00
parent c26de7fbb8
commit 9aae899da2
7 changed files with 123 additions and 86 deletions

View File

@ -0,0 +1,31 @@
From e2126b5d4efdbddb15a3c354110055f40d78f4cc Mon Sep 17 00:00:00 2001
From: wwx930846 <wuchaochao4@huawei.com>
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

View File

@ -8,12 +8,12 @@ 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__)
-

Binary file not shown.

BIN
pip-20.2.2.tar.gz Normal file

Binary file not shown.

View File

@ -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())

View File

@ -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}
%{__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 python%{python3_pkgversion}-%{srcname}
%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}/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<wenzhanli2@huawei.com> - 20.2.2-1
- update to 20.2.2 and add python2 require
* Tue Jul 28 2020 jinzhimin<jinzhimin2@huawei.com> - 20.1.1-1
- update to 20.1.1

View File

@ -8,27 +8,25 @@ when pip install -U is executed.
Resolves: rhbz#1550368
Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com>
Co-Authored-By: Victor Stinner <vstinner@redhat.com>
---
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/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,7 +47,7 @@ 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.
@ -61,10 +59,10 @@ index cdb44d19..52e122c6 100644
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