Update to 22.0.3

This commit is contained in:
Lumir Balhar 2022-02-16 08:58:06 +01:00
parent 636f3bf0bd
commit 093cb73c53
3 changed files with 80 additions and 103 deletions

View File

@ -13,7 +13,7 @@
%endif
%global srcname pip
%global base_version 21.3.1
%global base_version 22.0.3
%global upstream_version %{base_version}%{?prerel}
%global python_wheel_name %{srcname}-%{upstream_version}-py3-none-any.whl
@ -21,7 +21,7 @@
Name: python-%{srcname}
Version: %{base_version}%{?prerel:~%{prerel}}
Release: 2%{?dist}
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.
@ -41,13 +41,16 @@ Summary: A tool for installing and managing Python packages
# packaging: ASL 2.0 or BSD
# pep517: MIT
# progress: ISC
# pygments: BSD
# pyparsing: MIT
# requests: ASL 2.0
# resolvelib: ISC
# rich: MIT
# setuptools: MIT
# six: MIT
# tenacity: ASL 2.0
# tomli: MIT
# typing-extensions: Python
# urllib3: MIT
# webencodings: BSD
@ -121,27 +124,30 @@ Packages" or "Pip Installs Python".
# You can generate it with:
# %%{_rpmconfigdir}/pythonbundles.py --namespace 'python%%{1}dist' src/pip/_vendor/vendor.txt
%global bundled() %{expand:
Provides: bundled(python%{1}dist(cachecontrol)) = 0.12.6
Provides: bundled(python%{1}dist(certifi)) = 2021.5.30
Provides: bundled(python%{1}dist(cachecontrol)) = 0.12.10
Provides: bundled(python%{1}dist(certifi)) = 2021.10.8
Provides: bundled(python%{1}dist(chardet)) = 4
Provides: bundled(python%{1}dist(colorama)) = 0.4.4
Provides: bundled(python%{1}dist(distlib)) = 0.3.3
Provides: bundled(python%{1}dist(distlib)) = 0.3.4
Provides: bundled(python%{1}dist(distro)) = 1.6
Provides: bundled(python%{1}dist(html5lib)) = 1.1
Provides: bundled(python%{1}dist(idna)) = 3.2
Provides: bundled(python%{1}dist(msgpack)) = 1.0.2
Provides: bundled(python%{1}dist(packaging)) = 21
Provides: bundled(python%{1}dist(idna)) = 3.3
Provides: bundled(python%{1}dist(msgpack)) = 1.0.3
Provides: bundled(python%{1}dist(packaging)) = 21.3
Provides: bundled(python%{1}dist(pep517)) = 0.12
Provides: bundled(python%{1}dist(platformdirs)) = 2.4
Provides: bundled(python%{1}dist(platformdirs)) = 2.4.1
Provides: bundled(python%{1}dist(progress)) = 1.6
Provides: bundled(python%{1}dist(pyparsing)) = 2.4.7
Provides: bundled(python%{1}dist(requests)) = 2.26
Provides: bundled(python%{1}dist(resolvelib)) = 0.8
Provides: bundled(python%{1}dist(pygments)) = 2.11.2
Provides: bundled(python%{1}dist(pyparsing)) = 3.0.7
Provides: bundled(python%{1}dist(requests)) = 2.27.1
Provides: bundled(python%{1}dist(resolvelib)) = 0.8.1
Provides: bundled(python%{1}dist(rich)) = 11
Provides: bundled(python%{1}dist(setuptools)) = 44
Provides: bundled(python%{1}dist(six)) = 1.16
Provides: bundled(python%{1}dist(tenacity)) = 8.0.1
Provides: bundled(python%{1}dist(tomli)) = 1.0.3
Provides: bundled(python%{1}dist(urllib3)) = 1.26.7
Provides: bundled(python%{1}dist(typing-extensions)) = 4.0.1
Provides: bundled(python%{1}dist(urllib3)) = 1.26.8
Provides: bundled(python%{1}dist(webencodings)) = 0.5.1
}
@ -184,6 +190,7 @@ BuildRequires: python%{python3_pkgversion}-scripttest
BuildRequires: python%{python3_pkgversion}-virtualenv
BuildRequires: python%{python3_pkgversion}-werkzeug
BuildRequires: python%{python3_pkgversion}-pyyaml
BuildRequires: python%{python3_pkgversion}-tomli-w
%endif
BuildRequires: python%{python3_pkgversion}-wheel
BuildRequires: ca-certificates
@ -359,13 +366,11 @@ pytest_k='not completion and
not test_from_link_vcs_without_source_dir and
not test_should_cache_git_sha'
# test_pep517 and test_pep660 are ignored entirely, as they import tomli_w and we don't have that packaged yet
# --deselect'ed tests are not compatible with the latest virtualenv
# These files contain almost 500 tests so we should enable them back
# as soon as pip will be compatible upstream
# https://github.com/pypa/pip/pull/8441
%pytest -m 'not network' -k "$(echo $pytest_k)" \
--ignore tests/functional/test_pep660.py --ignore tests/functional/test_pep517.py \
--deselect tests/functional --deselect tests/lib/test_lib.py --deselect tests/unit/test_build_env.py
%endif
@ -402,6 +407,10 @@ pytest_k='not completion and
%{python_wheel_dir}/%{python_wheel_name}
%changelog
* Wed Feb 16 2022 Lumír Balhar <lbalhar@redhat.com> - 22.0.3-1
- Update to 22.0.3
Resolves: rhbz#2048243
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 21.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

View File

@ -1,14 +1,12 @@
From 517656ed4520b09ac6365467e459778f94ca2f0c Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Mon, 10 May 2021 18:16:20 +0200
From d4c72aa37d16e19c0f157e86203a66cad32a9c80 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Wed, 16 Feb 2022 08:36:21 +0100
Subject: [PATCH] Prevent removing of the system packages installed under
/usr/lib
/usr/lib when pip install --upgrade is executed.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
when pip install --upgrade is executed.
Resolves: rhbz#1550368
Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com>
@ -16,59 +14,74 @@ Co-Authored-By: Victor Stinner <vstinner@redhat.com>
Co-Authored-By: Petr Viktorin <pviktori@redhat.com>
Co-Authored-By: Lumir Balhar <lbalhar@redhat.com>
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
Co-Authored-By: Karolina Surma <ksurma@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 | 13 +++++++++++++
src/pip/_internal/utils/misc.py | 11 +++++++++++
4 files changed, 30 insertions(+), 2 deletions(-)
src/pip/_internal/metadata/base.py | 12 +++++++++++-
src/pip/_internal/req/req_install.py | 2 +-
src/pip/_internal/resolution/legacy/resolver.py | 4 +++-
src/pip/_internal/resolution/resolvelib/factory.py | 12 ++++++++++++
4 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/pip/_internal/metadata/base.py b/src/pip/_internal/metadata/base.py
index 1a5a781..3df4ab2 100644
--- a/src/pip/_internal/metadata/base.py
+++ b/src/pip/_internal/metadata/base.py
@@ -24,7 +24,7 @@ from pip._vendor.packaging.utils import NormalizedName
from pip._vendor.packaging.version import LegacyVersion, Version
from pip._internal.exceptions import NoneMetadataError
-from pip._internal.locations import site_packages, user_site
+from pip._internal.locations import get_scheme, site_packages, user_site
from pip._internal.models.direct_url import (
DIRECT_URL_METADATA_NAME,
DirectUrl,
@@ -441,6 +441,16 @@ class BaseDistribution(Protocol):
or self._iter_declared_entries_from_legacy()
)
+ @property
+ def in_install_path(self) -> bool:
+ """
+ Return True if given Distribution is installed in
+ path matching distutils_scheme layout.
+ """
+ norm_path = normalize_path(self.installed_location)
+ return norm_path.startswith(normalize_path(
+ get_scheme("").purelib.split('python')[0]))
+
class BaseEnvironment:
"""An environment containing distributions to introspect."""
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index ff0dd2f..a72aec8 100644
index 02dbda1..a952357 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -46,6 +46,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_distribution,
@@ -433,7 +434,7 @@ class InstallRequirement:
existing_dist.project_name, existing_dist.location
)
@@ -406,7 +406,7 @@ class InstallRequirement:
f"lack sys.path precedence to {existing_dist.raw_name} "
f"in {existing_dist.location}"
)
- else:
+ elif dist_in_install_path(existing_dist):
+ elif existing_dist.in_install_path:
self.should_reinstall = True
else:
if self.editable:
diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py
index 09caaa6..c1542ec 100644
index 8c149d4..a944906 100644
--- a/src/pip/_internal/resolution/legacy/resolver.py
+++ b/src/pip/_internal/resolution/legacy/resolver.py
@@ -44,6 +44,7 @@ from pip._internal.resolution.base import BaseResolver, InstallRequirementProvid
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
+from pip._internal.utils.misc import dist_in_install_path
from pip._internal.utils.packaging import check_requires_python
logger = logging.getLogger(__name__)
@@ -203,7 +204,9 @@ class Resolver(BaseResolver):
@@ -203,7 +203,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 req.satisfied_by.in_usersite:
+ if ((not self.use_user_site
+ or dist_in_usersite(req.satisfied_by))
+ and dist_in_install_path(req.satisfied_by)):
+ or req.satisfied_by.in_usersite)
+ and req.satisfied_by.in_install_path):
req.should_reinstall = True
req.satisfied_by = None
diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py
index 766dc26..c8c1cd8 100644
index 261d8d5..d1b7728 100644
--- a/src/pip/_internal/resolution/resolvelib/factory.py
+++ b/src/pip/_internal/resolution/resolvelib/factory.py
@@ -1,6 +1,8 @@
@ -80,32 +93,16 @@ index 766dc26..c8c1cd8 100644
from typing import (
TYPE_CHECKING,
Dict,
@@ -33,6 +34,7 @@ from pip._internal.exceptions import (
UnsupportedWheel,
)
from pip._internal.index.package_finder import PackageFinder
+from pip._internal.locations import get_scheme
from pip._internal.metadata import BaseDistribution, get_default_environment
from pip._internal.models.link import Link
from pip._internal.models.wheel import Wheel
@@ -45,6 +47,7 @@ from pip._internal.req.req_install import (
from pip._internal.resolution.base import InstallRequirementProvider
from pip._internal.utils.compatibility_tags import get_supported
from pip._internal.utils.hashes import Hashes
+from pip._internal.utils.misc import dist_location
from pip._internal.utils.packaging import get_requirement
from pip._internal.utils.virtualenv import running_under_virtualenv
@@ -526,6 +529,16 @@ class Factory:
@@ -564,6 +566,16 @@ class Factory:
if dist is None: # Not installed, no uninstallation required.
return None
+ # Prevent uninstalling packages from /usr
+ try:
+ if dist_location(dist._dist) in (
+ if dist.installed_location in (
+ sysconfig.get_path('purelib', scheme='rpm_prefix', vars={'base': sys.base_prefix}),
+ sysconfig.get_path('platlib', scheme='rpm_prefix', vars={'base': sys.base_prefix}),
+ ):
+ ):
+ return None
+ except KeyError: # this Python doesn't have 'rpm_prefix' scheme yet
+ pass
@ -113,35 +110,6 @@ index 766dc26..c8c1cd8 100644
# 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
index d3e9053..d25d1c3 100644
--- a/src/pip/_internal/utils/misc.py
+++ b/src/pip/_internal/utils/misc.py
@@ -38,6 +38,7 @@ from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
from pip import __version__
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_scheme
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.egg_link import egg_link_path_from_location
from pip._internal.utils.virtualenv import running_under_virtualenv
@@ -354,6 +355,16 @@ def dist_in_site_packages(dist: Distribution) -> bool:
return dist_location(dist).startswith(normalize_path(site_packages))
+def dist_in_install_path(dist):
+ """
+ Return True if given Distribution is installed in
+ path matching distutils_scheme layout.
+ """
+ norm_path = normalize_path(dist_location(dist))
+ return norm_path.startswith(normalize_path(
+ get_scheme("").purelib.split('python')[0]))
+
+
def get_distribution(req_name: str) -> Optional[Distribution]:
"""Given a requirement name, return the installed Distribution object.
--
2.32.0
2.35.1

View File

@ -1 +1 @@
SHA512 (pip-21.3.1.tar.gz) = 2f50f95fe36cffc18821a70824f5b28d03598894f9ea5b02acc4921d16fc7739131814828a2159bcd577331cc780c7776a3669fa1ca2d4690c861add10a16f00
SHA512 (pip-22.0.3.tar.gz) = 05f0807b298c2136842ad1cae3b003f81d85ca79103f12171e4c8d020d6add076848c1acfb6442c4ae2da6b834de0e87dffaec7bd24dfc403372cead94949326