!131 update version to 22.3.1

From: @zhuofeng6 
Reviewed-by: @gaoruoshu 
Signed-off-by: @gaoruoshu
This commit is contained in:
openeuler-ci-bot 2023-01-31 02:59:09 +00:00 committed by Gitee
commit c70dbd6adc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 204 additions and 224 deletions

View File

@ -1,31 +0,0 @@
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
@@ -134,6 +134,13 @@ class InstallCommand(RequirementCommand):
"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.src())
--
2.23.0

View File

@ -1,35 +1,128 @@
From 09bf87d33141a5c06a1d410839d162262baa16c4 Mon Sep 17 00:00:00 2001 From 09c983fdeabe3fa0b90b73f32ddf84a61e498e09 Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com> From: Karolina Surma <ksurma@redhat.com>
Date: Sun, 26 Apr 2020 21:38:44 +0200 Date: Tue, 15 Nov 2022 09:22:46 +0100
Subject: [PATCH] Dummy certifi patch Subject: [PATCH] Dummy certifi patch
--- ---
src/pip/_vendor/certifi/core.py | 5 ++--- src/pip/_vendor/certifi/core.py | 105 ++------------------------------
1 file changed, 2 insertions(+), 3 deletions(-) 1 file changed, 6 insertions(+), 99 deletions(-)
diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py
index 8987449..568d078 100644 index c3e5466..eb297f7 100644
--- a/src/pip/_vendor/certifi/core.py --- a/src/pip/_vendor/certifi/core.py
+++ b/src/pip/_vendor/certifi/core.py +++ b/src/pip/_vendor/certifi/core.py
@@ -23,6 +23,7 @@ try: @@ -4,105 +4,12 @@ certifi.py
return _PIP_STANDALONE_CERT
raise _PipPatchedCertificate()
+ raise ImportError # force fallback This module returns the installation location of cacert.pem or its contents.
from importlib.resources import path as get_path, read_text """
-import sys
_CACERT_CTX = None +# The RPM-packaged certifi always uses the system certificates
@@ -67,9 +68,7 @@ except ImportError: +def where() -> str:
# If we don't have importlib.resources, then we will just do the old logic + return '/etc/pki/tls/certs/ca-bundle.crt'
# of assuming we're on the filesystem and munge the path directly.
def where(): -if sys.version_info >= (3, 11):
+def contents() -> str:
+ with open(where(), encoding='utf=8') as data:
+ return data.read()
- from importlib.resources import as_file, files
-
- _CACERT_CTX = None
- _CACERT_PATH = None
-
- def where() -> str:
- # This is slightly terrible, but we want to delay extracting the file
- # in cases where we're inside of a zipimport situation until someone
- # actually calls where(), but we don't want to re-extract the file
- # on every call of where(), so we'll do it once then store it in a
- # global variable.
- global _CACERT_CTX
- global _CACERT_PATH
- if _CACERT_PATH is None:
- # This is slightly janky, the importlib.resources API wants you to
- # manage the cleanup of this file, so it doesn't actually return a
- # path, it returns a context manager that will give you the path
- # when you enter it and will do any cleanup when you leave it. In
- # the common case of not needing a temporary file, it will just
- # return the file system location and the __exit__() is a no-op.
- #
- # We also have to hold onto the actual context manager, because
- # it will do the cleanup whenever it gets garbage collected, so
- # we will also store that at the global level as well.
- _CACERT_CTX = as_file(files("pip._vendor.certifi").joinpath("cacert.pem"))
- _CACERT_PATH = str(_CACERT_CTX.__enter__())
-
- return _CACERT_PATH
-
- def contents() -> str:
- return files("pip._vendor.certifi").joinpath("cacert.pem").read_text(encoding="ascii")
-
-elif sys.version_info >= (3, 7):
-
- from importlib.resources import path as get_path, read_text
-
- _CACERT_CTX = None
- _CACERT_PATH = None
-
- def where() -> str:
- # This is slightly terrible, but we want to delay extracting the
- # file in cases where we're inside of a zipimport situation until
- # someone actually calls where(), but we don't want to re-extract
- # the file on every call of where(), so we'll do it once then store
- # it in a global variable.
- global _CACERT_CTX
- global _CACERT_PATH
- if _CACERT_PATH is None:
- # This is slightly janky, the importlib.resources API wants you
- # to manage the cleanup of this file, so it doesn't actually
- # return a path, it returns a context manager that will give
- # you the path when you enter it and will do any cleanup when
- # you leave it. In the common case of not needing a temporary
- # file, it will just return the file system location and the
- # __exit__() is a no-op.
- #
- # We also have to hold onto the actual context manager, because
- # it will do the cleanup whenever it gets garbage collected, so
- # we will also store that at the global level as well.
- _CACERT_CTX = get_path("pip._vendor.certifi", "cacert.pem")
- _CACERT_PATH = str(_CACERT_CTX.__enter__())
-
- return _CACERT_PATH
-
- def contents() -> str:
- return read_text("pip._vendor.certifi", "cacert.pem", encoding="ascii")
-
-else:
- import os
- import types
- from typing import Union
-
- Package = Union[types.ModuleType, str]
- Resource = Union[str, "os.PathLike"]
-
- # This fallback will work for Python versions prior to 3.7 that lack the
- # importlib.resources module but relies on the existing `where` function
- # so won't address issues with environments like PyOxidizer that don't set
- # __file__ on modules.
- def read_text(
- package: Package,
- resource: Resource,
- encoding: str = 'utf-8',
- errors: str = 'strict'
- ) -> str:
- with open(where(), encoding=encoding) as data:
- return data.read()
-
- # 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() -> str:
- f = os.path.dirname(__file__) - f = os.path.dirname(__file__)
- -
- return os.path.join(f, "cacert.pem") - return os.path.join(f, "cacert.pem")
+ return '/etc/pki/tls/certs/ca-bundle.crt' -
- def contents() -> str:
- return read_text("pip._vendor.certifi", "cacert.pem", encoding="ascii")
def contents():
-- --
1.8.3.1 2.37.3

View File

@ -1,51 +0,0 @@
From 74bb5d26e232493de43adfa1f4b42b66fd701294 Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Sun, 26 Apr 2020 13:52:24 +0200
Subject: [PATCH] Downstream only patch
Emit a warning to the user if pip install is run with root privileges
Issue upstream: https://github.com/pypa/pip/issues/4288
---
src/pip/_internal/commands/install.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
index 70bda2e2..1e750ae1 100644
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -13,6 +13,8 @@ import operator
import os
import shutil
import site
+import sys
+from os import path
from optparse import SUPPRESS_HELP, Values
from typing import Iterable, List, Optional
@@ -241,6 +243,23 @@ class InstallCommand(RequirementCommand):
raise CommandError("Can not combine '--user' and '--target'")
cmdoptions.check_install_build_global(options)
+
+ def is_venv():
+ return (hasattr(sys, 'real_prefix') or
+ (hasattr(sys, 'base_prefix') and
+ sys.base_prefix != sys.prefix))
+
+ # Check whether we have root privileges and aren't in venv/virtualenv
+ if os.getuid() == 0 and not is_venv() and not options.root_path:
+ command = path.basename(sys.argv[0])
+ if command == "__main__.py":
+ command = path.basename(sys.executable) + " -m pip"
+ logger.warning(
+ "Running pip install with root privileges is "
+ "generally not a good idea. Try `%s install --user` instead."
+ % command
+ )
+
upgrade_strategy = "to-satisfy-only"
if options.upgrade:
upgrade_strategy = options.upgrade_strategy
--
2.23.0

Binary file not shown.

BIN
pip-22.3.1.tar.gz Normal file

Binary file not shown.

View File

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

View File

@ -5,16 +5,14 @@
pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes. 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}) %global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d})
Name: python-%{srcname} Name: python-%{srcname}
Version: 21.3.1 Version: 22.3.1
Release: 3 Release: 1
Summary: A tool for installing and managing Python packages 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) 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 URL: http://www.pip-installer.org
Source0: %{pypi_source} Source0: %{pypi_source}
BuildArch: noarch BuildArch: noarch
Patch1: allow-stripping-given-prefix-from-wheel-RECORD-files.patch Patch1: remove-existing-dist-only-if-path-conflicts.patch
Patch2: emit-a-warning-when-running-with-root-privileges.patch
Patch3: remove-existing-dist-only-if-path-conflicts.patch
Patch6000: dummy-certifi.patch Patch6000: dummy-certifi.patch
Source10: pip-allow-older-versions.patch Source10: pip-allow-older-versions.patch
@ -120,6 +118,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
%{python_wheeldir}/%{python_wheelname} %{python_wheeldir}/%{python_wheelname}
%changelog %changelog
* Sat Jan 28 2023 zhuofeng<zhuofeng2@huawei.com> - 22.3.1-1
- upgrade version to 22.3.1
* Wed Aug 03 2022 renhongxun <renhongxun@h-partners.com> - 21.3.1-3 * Wed Aug 03 2022 renhongxun <renhongxun@h-partners.com> - 21.3.1-3
- provides python3.10dist(pip) and python3dist(pip) - provides python3.10dist(pip) and python3dist(pip)

View File

@ -1,14 +1,12 @@
From 517656ed4520b09ac6365467e459778f94ca2f0c Mon Sep 17 00:00:00 2001 From 2c3f3a590ddfc151a456b44a5f96f0f603d178e9 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com> From: Lumir Balhar <lbalhar@redhat.com>
Date: Mon, 10 May 2021 18:16:20 +0200 Date: Wed, 16 Feb 2022 08:36:21 +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 --upgrade is executed.
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
when pip install --upgrade is executed.
Resolves: rhbz#1550368 Resolves: rhbz#1550368
Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com> 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: Petr Viktorin <pviktori@redhat.com>
Co-Authored-By: Lumir Balhar <lbalhar@redhat.com> Co-Authored-By: Lumir Balhar <lbalhar@redhat.com>
Co-Authored-By: Miro Hrončok <miro@hroncok.cz> 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/metadata/base.py | 12 +++++++++++-
src/pip/_internal/resolution/legacy/resolver.py | 5 ++++- src/pip/_internal/req/req_install.py | 2 +-
src/pip/_internal/resolution/resolvelib/factory.py | 13 +++++++++++++ src/pip/_internal/resolution/legacy/resolver.py | 4 +++-
src/pip/_internal/utils/misc.py | 11 +++++++++++ src/pip/_internal/resolution/resolvelib/factory.py | 12 ++++++++++++
4 files changed, 30 insertions(+), 2 deletions(-) 4 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/pip/_internal/metadata/base.py b/src/pip/_internal/metadata/base.py
index 151fd6d..f9109cd 100644
--- a/src/pip/_internal/metadata/base.py
+++ b/src/pip/_internal/metadata/base.py
@@ -28,7 +28,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,
@@ -560,6 +560,16 @@ class BaseDistribution(Protocol):
for extra in self._iter_egg_info_extras():
metadata["Provides-Extra"] = extra
+ @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 diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index ff0dd2f..a72aec8 100644 index a1e376c..ed7facf 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
@@ -46,6 +46,7 @@ from pip._internal.utils.misc import ( @@ -416,7 +416,7 @@ class InstallRequirement:
ask_path_exists, f"lack sys.path precedence to {existing_dist.raw_name} "
backup_dir, f"in {existing_dist.location}"
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
)
) )
- else: - else:
+ elif dist_in_install_path(existing_dist): + elif existing_dist.in_install_path:
self.should_reinstall = True self.should_reinstall = True
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 09caaa6..c1542ec 100644 index fb49d41..040f2c1 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
@@ -44,6 +44,7 @@ from pip._internal.resolution.base import BaseResolver, InstallRequirementProvid @@ -325,7 +325,9 @@ class Resolver(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
+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):
""" """
# Don't uninstall the conflict if doing a user install and the # Don't uninstall the conflict if doing a user install and the
# conflict is not a user install. # 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 + if ((not self.use_user_site
+ or dist_in_usersite(req.satisfied_by)) + or req.satisfied_by.in_usersite)
+ and dist_in_install_path(req.satisfied_by)): + and req.satisfied_by.in_install_path):
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 diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py
index 766dc26..c8c1cd8 100644 index a4c24b5..e7e2da9 100644
--- a/src/pip/_internal/resolution/resolvelib/factory.py --- a/src/pip/_internal/resolution/resolvelib/factory.py
+++ b/src/pip/_internal/resolution/resolvelib/factory.py +++ b/src/pip/_internal/resolution/resolvelib/factory.py
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
@ -80,32 +93,16 @@ index 766dc26..c8c1cd8 100644
from typing import ( from typing import (
TYPE_CHECKING, TYPE_CHECKING,
Dict, Dict,
@@ -33,6 +34,7 @@ from pip._internal.exceptions import ( @@ -549,6 +551,16 @@ class Factory:
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:
if dist is None: # Not installed, no uninstallation required. if dist is None: # Not installed, no uninstallation required.
return None return None
+ # Prevent uninstalling packages from /usr + # Prevent uninstalling packages from /usr
+ try: + 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('purelib', scheme='posix_prefix', vars={'base': sys.base_prefix}),
+ sysconfig.get_path('platlib', scheme='rpm_prefix', vars={'base': sys.base_prefix}), + sysconfig.get_path('platlib', scheme='posix_prefix', vars={'platbase': sys.base_prefix}),
+ ): + ):
+ return None + return None
+ except KeyError: # this Python doesn't have 'rpm_prefix' scheme yet + except KeyError: # this Python doesn't have 'rpm_prefix' scheme yet
+ pass + pass
@ -113,35 +110,6 @@ index 766dc26..c8c1cd8 100644
# We're installing into global site. The current installation must # We're installing into global site. The current installation must
# be uninstalled, no matter it's in global or user site, because the # be uninstalled, no matter it's in global or user site, because the
# user site installation has precedence over global. # 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.3