Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/python-pip.git#093819ce2ef1ccaecd829ad2c445156db11b0774
This commit is contained in:
DistroBaker 2021-01-27 11:42:40 +00:00
parent b7b3cef88c
commit 7df2664e6d
4 changed files with 84 additions and 62 deletions

View File

@ -13,16 +13,16 @@
%endif %endif
%global srcname pip %global srcname pip
%global base_version 20.3.3 %global base_version 21.0
%global upstream_version %{base_version}%{?prerel} %global upstream_version %{base_version}%{?prerel}
%global python_wheelname %{srcname}-%{upstream_version}-py2.py3-none-any.whl %global python_wheelname %{srcname}-%{upstream_version}-py3-none-any.whl
%global python_wheeldir %{_datadir}/python-wheels %global python_wheeldir %{_datadir}/python-wheels
%global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null) %global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null)
Name: python-%{srcname} Name: python-%{srcname}
Version: %{base_version}%{?prerel:~%{prerel}} Version: %{base_version}%{?prerel:~%{prerel}}
Release: 3%{?dist} Release: 1%{?dist}
Summary: A tool for installing and managing Python packages Summary: A tool for installing and managing Python packages
# We bundle a lot of libraries with pip, which itself is under MIT license. # We bundle a lot of libraries with pip, which itself is under MIT license.
@ -130,22 +130,21 @@ Packages" or "Pip Installs Python".
%global bundled() %{expand: %global bundled() %{expand:
Provides: bundled(python%{1}dist(appdirs)) = 1.4.4 Provides: bundled(python%{1}dist(appdirs)) = 1.4.4
Provides: bundled(python%{1}dist(cachecontrol)) = 0.12.6 Provides: bundled(python%{1}dist(cachecontrol)) = 0.12.6
Provides: bundled(python%{1}dist(certifi)) = 2020.11.8 Provides: bundled(python%{1}dist(certifi)) = 2020.12.5
Provides: bundled(python%{1}dist(chardet)) = 3.0.4 Provides: bundled(python%{1}dist(chardet)) = 4
Provides: bundled(python%{1}dist(colorama)) = 0.4.4 Provides: bundled(python%{1}dist(colorama)) = 0.4.4
Provides: bundled(python%{1}dist(contextlib2)) = 0.6^post1 Provides: bundled(python%{1}dist(contextlib2)) = 0.6^post1
Provides: bundled(python%{1}dist(distlib)) = 0.3.1 Provides: bundled(python%{1}dist(distlib)) = 0.3.1
Provides: bundled(python%{1}dist(distro)) = 1.5 Provides: bundled(python%{1}dist(distro)) = 1.5
Provides: bundled(python%{1}dist(html5lib)) = 1.1 Provides: bundled(python%{1}dist(html5lib)) = 1.1
Provides: bundled(python%{1}dist(idna)) = 2.10 Provides: bundled(python%{1}dist(idna)) = 2.10
Provides: bundled(python%{1}dist(ipaddress)) = 1.0.23 Provides: bundled(python%{1}dist(msgpack)) = 1.0.2
Provides: bundled(python%{1}dist(msgpack)) = 1
Provides: bundled(python%{1}dist(packaging)) = 20.8 Provides: bundled(python%{1}dist(packaging)) = 20.8
Provides: bundled(python%{1}dist(pep517)) = 0.9.1 Provides: bundled(python%{1}dist(pep517)) = 0.9.1
Provides: bundled(python%{1}dist(progress)) = 1.5 Provides: bundled(python%{1}dist(progress)) = 1.5
Provides: bundled(python%{1}dist(pyparsing)) = 2.4.7 Provides: bundled(python%{1}dist(pyparsing)) = 2.4.7
Provides: bundled(python%{1}dist(requests)) = 2.25 Provides: bundled(python%{1}dist(requests)) = 2.25.1
Provides: bundled(python%{1}dist(resolvelib)) = 0.5.3 Provides: bundled(python%{1}dist(resolvelib)) = 0.5.4
Provides: bundled(python%{1}dist(retrying)) = 1.3.3 Provides: bundled(python%{1}dist(retrying)) = 1.3.3
Provides: bundled(python%{1}dist(setuptools)) = 44 Provides: bundled(python%{1}dist(setuptools)) = 44
Provides: bundled(python%{1}dist(six)) = 1.15 Provides: bundled(python%{1}dist(six)) = 1.15
@ -256,13 +255,14 @@ rm src/pip/_vendor/certifi/*.pem
# furo is not available in Fedora # furo is not available in Fedora
sed -i '/html_theme = "furo"/d' docs/html/conf.py sed -i '/html_theme = "furo"/d' docs/html/conf.py
# towncrier extension for Sphinx is not yet available in Fedora
sed -i "/'sphinxcontrib.towncrier',/d" docs/html/conf.py
# tests expect wheels in here # tests expect wheels in here
ln -s %{python_wheeldir} tests/data/common_wheels ln -s %{python_wheeldir} tests/data/common_wheels
# Upstream uses a Python 2/3 compatibility library for csv with Python 3 semantics in tests # Remove shebang from files in bundled chardet
# We only target Python 3 and csv23 is not (yet) packaged grep -lr "^#\!/usr/bin/env python" src/pip/_vendor/chardet/ | xargs sed -i "1d"
# As of 20.1b1, this workaround was sufficient to get around the missing dependency
sed -i -e 's/csv23/csv/g' tests/lib/wheel.py
%build %build
@ -398,6 +398,9 @@ pytest_k='not completion and
%{python_wheeldir}/%{python_wheelname} %{python_wheeldir}/%{python_wheelname}
%changelog %changelog
* Tue Jan 26 2021 Lumír Balhar <lbalhar@redhat.com> - 21.0-1
- Update to 21.0 (#1919530)
* Thu Dec 17 2020 Petr Viktorin <pviktori@redhat.com> - 20.3.3-1 * Thu Dec 17 2020 Petr Viktorin <pviktori@redhat.com> - 20.3.3-1
- Update to 20.3.3 - Update to 20.3.3

View File

@ -1,7 +1,7 @@
From 854fd7296bb9306d46ba3cc8bb7c6f18a7960ed6 Mon Sep 17 00:00:00 2001 From 0c41df7c4161de2453d5161382a3bbfc7178bec6 Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com> From: Lumir Balhar <lbalhar@redhat.com>
Date: Sun, 26 Apr 2020 21:19:03 +0200 Date: Tue, 26 Jan 2021 09:05:07 +0100
Subject: [PATCH] Prevent removing of the system packages installed under Subject: [PATCH] Prevent removing of the system packages installed under
/usr/lib /usr/lib
when pip install -U is executed. when pip install -U is executed.
@ -12,11 +12,17 @@ Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com>
Co-Authored-By: Victor Stinner <vstinner@redhat.com> Co-Authored-By: Victor Stinner <vstinner@redhat.com>
Co-Authored-By: Petr Viktorin <pviktori@redhat.com> Co-Authored-By: Petr Viktorin <pviktori@redhat.com>
--- ---
src/pip/_internal/req/req_install.py | 3 ++-
src/pip/_internal/resolution/legacy/resolver.py | 5 ++++-
src/pip/_internal/resolution/resolvelib/factory.py | 10 ++++++++++
src/pip/_internal/utils/misc.py | 11 +++++++++++
4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 4759f4a..2e76e35 100644 index 6d0aa30..0a5f8ed 100644
--- a/src/pip/_internal/req/req_install.py --- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py
@@ -41,6 +41,7 @@ from pip._internal.utils.misc import ( @@ -39,6 +39,7 @@ from pip._internal.utils.misc import (
ask_path_exists, ask_path_exists,
backup_dir, backup_dir,
display_path, display_path,
@ -24,7 +30,7 @@ index 4759f4a..2e76e35 100644
dist_in_site_packages, dist_in_site_packages,
dist_in_usersite, dist_in_usersite,
get_distribution, get_distribution,
@@ -447,7 +448,7 @@ class InstallRequirement(object): @@ -445,7 +446,7 @@ class InstallRequirement:
"lack sys.path precedence to {} in {}".format( "lack sys.path precedence to {} in {}".format(
existing_dist.project_name, existing_dist.location) existing_dist.project_name, existing_dist.location)
) )
@ -34,7 +40,7 @@ index 4759f4a..2e76e35 100644
else: else:
if self.editable: if self.editable:
diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py
index c9b4c66..ff361d8 100644 index 665dba1..a219e63 100644
--- a/src/pip/_internal/resolution/legacy/resolver.py --- a/src/pip/_internal/resolution/legacy/resolver.py
+++ b/src/pip/_internal/resolution/legacy/resolver.py +++ b/src/pip/_internal/resolution/legacy/resolver.py
@@ -34,6 +34,7 @@ from pip._internal.resolution.base import BaseResolver @@ -34,6 +34,7 @@ from pip._internal.resolution.base import BaseResolver
@ -56,20 +62,53 @@ index c9b4c66..ff361d8 100644
req.should_reinstall = True req.should_reinstall = True
req.satisfied_by = None req.satisfied_by = None
diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py
index bfaa052..68915aa 100644
--- a/src/pip/_internal/resolution/resolvelib/factory.py
+++ b/src/pip/_internal/resolution/resolvelib/factory.py
@@ -1,4 +1,5 @@
import logging
+import sys
from pip._vendor.packaging.utils import canonicalize_name
@@ -18,7 +19,9 @@ from pip._internal.utils.misc import (
dist_in_site_packages,
dist_in_usersite,
get_installed_distributions,
+ dist_location,
)
+from pip._internal.locations import distutils_scheme
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.virtualenv import running_under_virtualenv
@@ -365,6 +368,13 @@ class Factory:
if dist is None: # Not installed, no uninstallation required.
return None
+ # Prevent uninstalling packages from /usr
+ if dist_location(dist) in (
+ distutils_scheme('', prefix=sys.base_prefix)['purelib'],
+ distutils_scheme('', prefix=sys.base_prefix)['platlib'],
+ ):
+ return None
+
# We're installing into global site. The current installation must
# be uninstalled, no matter it's in global or user site, because the
# user site installation has precedence over global.
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
index 24a7455..5fd48d3 100644 index 6dd94e2..7925518 100644
--- a/src/pip/_internal/utils/misc.py --- a/src/pip/_internal/utils/misc.py
+++ b/src/pip/_internal/utils/misc.py +++ b/src/pip/_internal/utils/misc.py
@@ -31,7 +31,7 @@ from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote @@ -27,6 +27,7 @@ from pip._vendor.retrying import retry # type: ignore
from pip import __version__ from pip import __version__
from pip._internal.exceptions import CommandError from pip._internal.exceptions import CommandError
-from pip._internal.locations import get_major_minor_version, site_packages, user_site from pip._internal.locations import get_major_minor_version, site_packages, user_site
+from pip._internal.locations import distutils_scheme, get_major_minor_version, site_packages, user_site +from pip._internal.locations import distutils_scheme, get_major_minor_version, site_packages, user_site
from pip._internal.utils.compat import WINDOWS, expanduser, stdlib_pkgs, str_to_display from pip._internal.utils.compat import WINDOWS, stdlib_pkgs
from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast
from pip._internal.utils.virtualenv import ( from pip._internal.utils.virtualenv import (
@@ -406,6 +406,16 @@ def dist_in_site_packages(dist): @@ -398,6 +399,16 @@ def dist_in_site_packages(dist):
return dist_location(dist).startswith(normalize_path(site_packages)) return dist_location(dist).startswith(normalize_path(site_packages))
@ -86,33 +125,6 @@ index 24a7455..5fd48d3 100644
def dist_is_editable(dist): def dist_is_editable(dist):
# type: (Distribution) -> bool # type: (Distribution) -> bool
""" """
--- a/src/pip/_internal/resolution/resolvelib/factory.py
+++ b/src/pip/_internal/resolution/resolvelib/factory.py
@@ -1,3 +1,4 @@
import logging
+import sys
from pip._vendor.packaging.utils import canonicalize_name
@@ -17,5 +18,7 @@
dist_in_usersite,
get_installed_distributions,
+ dist_location,
)
+from pip._internal.locations import distutils_scheme
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.virtualenv import running_under_virtualenv
@@ -313,4 +316,11 @@
return None
+ # Prevent uninstalling packages from /usr
+ if dist_location(dist) in (
+ distutils_scheme('', prefix=sys.base_prefix)['purelib'],
+ distutils_scheme('', prefix=sys.base_prefix)['platlib'],
+ ):
+ return None
+
# We're installing into global site. The current installation must
# be uninstalled, no matter it's in global or user site, because the
-- --
2.25.4 2.29.2

View File

@ -1 +1 @@
SHA512 (pip-20.3.3.tar.gz) = 362d20e5d2665fa6211cf3836ca02a0340fb34ecde1d5902eecae744eb655d7dcfed0bd464e9db186b87b63a7aaf275e43645cf6321bdddd44b62787de84d87b SHA512 (pip-21.0.tar.gz) = ac77a7204423f1fdc3a4d328dab1860258efccde0123cff3217f357637c4ce3d85772ab81a230122ff813be2cfa40f2862e5d499390289efe1dcde3a31a42264

View File

@ -28,6 +28,9 @@
- smoke39: - smoke39:
dir: python/smoke dir: python/smoke
run: VERSION=3.9 ./venv.sh run: VERSION=3.9 ./venv.sh
- smoke310:
dir: python/smoke
run: VERSION=3.10 ./venv.sh
- smoke27: - smoke27:
dir: python/smoke dir: python/smoke
run: VERSION=2.7 METHOD=virtualenv ./venv.sh run: VERSION=2.7 METHOD=virtualenv ./venv.sh
@ -49,6 +52,9 @@
- smoke39_virtualenv: - smoke39_virtualenv:
dir: python/smoke dir: python/smoke
run: VERSION=3.9 METHOD=virtualenv ./venv.sh run: VERSION=3.9 METHOD=virtualenv ./venv.sh
- smoke310_virtualenv:
dir: python/smoke
run: VERSION=3.10 METHOD=virtualenv ./venv.sh
- pipenv: - pipenv:
run: pipenv --three && pipenv install six run: pipenv --three && pipenv install six
- pyproject_pytest: - pyproject_pytest:
@ -66,12 +72,13 @@
required_packages: required_packages:
- gcc - gcc
- virtualenv - virtualenv
- python27 - python2.7
- python35 - python3.5
- python36 - python3.6
- python37 - python3.7
- python38 - python3.8
- python39 - python3.9
- python3.10
- python2-devel - python2-devel
- python3-devel - python3-devel
- python3-tox - python3-tox