Update to 22.2

Resolves: rhbz#2109468
This commit is contained in:
Charalampos Stratakis 2022-06-29 02:26:42 +02:00
parent 3e8bb70757
commit 6300db47ba
6 changed files with 56 additions and 135 deletions

View File

@ -1,76 +0,0 @@
From 452d7da8801ca318f280bd1c1085c60b0b6f747f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <thrnciar@redhat.com>
Date: Sat, 23 Apr 2022 16:56:59 +0200
Subject: [PATCH] Fallback to pyproject.toml-based builds if setuptools cannot
be imported (#10717)
This fallback is only triggered if the project has a `setup.py` file.
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
---
news/10717.bugfix.rst | 1 +
src/pip/_internal/cli/cmdoptions.py | 7 +++++++
src/pip/_internal/pyproject.py | 11 +++++++++--
3 files changed, 17 insertions(+), 2 deletions(-)
create mode 100644 news/10717.bugfix.rst
diff --git a/news/10717.bugfix.rst b/news/10717.bugfix.rst
new file mode 100644
index 00000000000..950a4521763
--- /dev/null
+++ b/news/10717.bugfix.rst
@@ -0,0 +1 @@
+Fallback to pyproject.toml-based builds if ``setup.py`` is present in a project, but ``setuptools`` cannot be imported.
diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py
index cd1e8a00f63..91b94e3028c 100644
--- a/src/pip/_internal/cli/cmdoptions.py
+++ b/src/pip/_internal/cli/cmdoptions.py
@@ -10,6 +10,7 @@
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
+import importlib.util
import logging
import os
import textwrap
@@ -770,6 +771,12 @@ def _handle_no_use_pep517(
"""
raise_option_error(parser, option=option, msg=msg)
+ # If user doesn't wish to use pep517, we check if setuptools is installed
+ # and raise error if it is not.
+ if not importlib.util.find_spec("setuptools"):
+ msg = "It is not possible to use --no-use-pep517 without setuptools installed."
+ raise_option_error(parser, option=option, msg=msg)
+
# Otherwise, --no-use-pep517 was passed via the command-line.
parser.values.use_pep517 = False
diff --git a/src/pip/_internal/pyproject.py b/src/pip/_internal/pyproject.py
index e183eaf8658..1e9119f3e5c 100644
--- a/src/pip/_internal/pyproject.py
+++ b/src/pip/_internal/pyproject.py
@@ -1,3 +1,4 @@
+import importlib.util
import os
from collections import namedtuple
from typing import Any, List, Optional
@@ -89,9 +90,15 @@ def load_pyproject_toml(
# If we haven't worked out whether to use PEP 517 yet,
# and the user hasn't explicitly stated a preference,
- # we do so if the project has a pyproject.toml file.
+ # we do so if the project has a pyproject.toml file
+ # or if we cannot import setuptools.
+
+ # We fallback to PEP 517 when without setuptools,
+ # so setuptools can be installed as a default build backend.
+ # For more info see:
+ # https://discuss.python.org/t/pip-without-setuptools-could-the-experience-be-improved/11810/9
elif use_pep517 is None:
- use_pep517 = has_pyproject
+ use_pep517 = has_pyproject or not importlib.util.find_spec("setuptools")
# At this point, we know whether we're going to use PEP 517.
assert use_pep517 is not None

View File

@ -1,4 +1,4 @@
From 2c58d7301dd5a47570f782fe2fce7fbb1918f60c Mon Sep 17 00:00:00 2001
From cacd6d2fa9a27b29415a4ce25d76406fe69fc398 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Mon, 10 May 2021 16:38:50 +0200
Subject: [PATCH] Dummy certifi patch
@ -9,7 +9,7 @@ Co-Authored-By: Tomas Hrnciar <thrnciar@redhat.com>
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py
index b8140cf..f1a0b01 100644
index f34045b..a2ada08 100644
--- a/src/pip/_vendor/certifi/core.py
+++ b/src/pip/_vendor/certifi/core.py
@@ -14,6 +14,7 @@ class _PipPatchedCertificate(Exception):
@ -20,17 +20,17 @@ index b8140cf..f1a0b01 100644
# Return a certificate file on disk for a standalone pip zipapp running in
# an isolated build environment to use. Passing --cert to the standalone
# pip does not work since requests calls where() unconditionally on import.
@@ -67,9 +68,7 @@ except ImportError:
@@ -75,9 +76,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():
def where() -> str:
- f = os.path.dirname(__file__)
-
- return os.path.join(f, "cacert.pem")
+ return '/etc/pki/tls/certs/ca-bundle.crt'
def contents():
def contents() -> str:
--
2.30.2
2.35.3

View File

@ -1,4 +1,4 @@
From 619782ad2d181fe2933ddf4edc7127fdc13dd0df Mon Sep 17 00:00:00 2001
From 8dd3793d1bab226cec9c5c49b01718a9634bc403 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Mon, 10 May 2021 16:48:49 +0200
Subject: [PATCH] Don't warn the user about pip._internal.main() entrypoint
@ -24,11 +24,11 @@ index 6afb5c6..faf25af 100755
- return _wrapper(args)
+ return _wrapper(args, _nowarn=True)
diff --git a/src/pip/_internal/utils/entrypoints.py b/src/pip/_internal/utils/entrypoints.py
index 1504a12..07d941b 100644
index f292c64..2e29a5e 100644
--- a/src/pip/_internal/utils/entrypoints.py
+++ b/src/pip/_internal/utils/entrypoints.py
@@ -4,7 +4,7 @@ from typing import List, Optional
from pip._internal.cli.main import main
@@ -20,7 +20,7 @@ if WINDOWS:
]
-def _wrapper(args: Optional[List[str]] = None) -> int:
@ -36,7 +36,7 @@ index 1504a12..07d941b 100644
"""Central wrapper for all old entrypoints.
Historically pip has had several entrypoints defined. Because of issues
@@ -16,12 +16,13 @@ def _wrapper(args: Optional[List[str]] = None) -> int:
@@ -32,14 +32,15 @@ def _wrapper(args: Optional[List[str]] = None) -> int:
directing them to an appropriate place for help, we now define all of
our old entrypoints as wrappers for the current one.
"""
@ -58,11 +58,13 @@ index 1504a12..07d941b 100644
+ "running pip directly.\n"
+ )
return main(args)
diff --git a/tests/functional/test_cli.py b/tests/functional/test_cli.py
index e416315..7f57f67 100644
index 3e85703..f86c392 100644
--- a/tests/functional/test_cli.py
+++ b/tests/functional/test_cli.py
@@ -31,4 +31,5 @@ def test_entrypoints_work(entrypoint, script):
@@ -43,4 +43,5 @@ def test_entrypoints_work(entrypoint: str, script: PipTestEnvironment) -> None:
result = script.pip("-V")
result2 = script.run("fake_pip", "-V", allow_stderr_warning=True)
assert result.stdout == result2.stdout
@ -70,5 +72,5 @@ index e416315..7f57f67 100644
+ if entrypoint[0] != "fake_pip = pip._internal:main":
+ assert "old script wrapper" in result2.stderr
--
2.32.0
2.35.3

View File

@ -13,7 +13,7 @@
%endif
%global srcname pip
%global base_version 22.0.4
%global base_version 22.2
%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: 5%{?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.
@ -89,10 +89,6 @@ Patch: nowarn-pip._internal.main.patch
# Upstream issue: https://github.com/pypa/packaging/issues/368
Patch: no-version-warning.patch
# Fallback to pep517 if setup.py is present and setuptools cannot be imported
# https://bugzilla.redhat.com/show_bug.cgi?id=2020635
Patch: https://github.com/pypa/pip/commit/452d7da880.patch
# Downstream only patch
# Users might have local installations of pip from using
# `pip install --user --upgrade pip` on older/newer versions.
@ -128,30 +124,28 @@ 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.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(distro)) = 1.6
Provides: bundled(python%{1}dist(html5lib)) = 1.1
Provides: bundled(python%{1}dist(cachecontrol)) = 0.12.11
Provides: bundled(python%{1}dist(certifi)) = 2022.6.15
Provides: bundled(python%{1}dist(chardet)) = 5
Provides: bundled(python%{1}dist(colorama)) = 0.4.5
Provides: bundled(python%{1}dist(distlib)) = 0.3.5
Provides: bundled(python%{1}dist(distro)) = 1.7
Provides: bundled(python%{1}dist(idna)) = 3.3
Provides: bundled(python%{1}dist(msgpack)) = 1.0.3
Provides: bundled(python%{1}dist(msgpack)) = 1.0.4
Provides: bundled(python%{1}dist(packaging)) = 21.3
Provides: bundled(python%{1}dist(pep517)) = 0.12
Provides: bundled(python%{1}dist(platformdirs)) = 2.4.1
Provides: bundled(python%{1}dist(progress)) = 1.6
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(platformdirs)) = 2.5.2
Provides: bundled(python%{1}dist(pygments)) = 2.12
Provides: bundled(python%{1}dist(pyparsing)) = 3.0.9
Provides: bundled(python%{1}dist(requests)) = 2.28.1
Provides: bundled(python%{1}dist(resolvelib)) = 0.8.1
Provides: bundled(python%{1}dist(rich)) = 11
Provides: bundled(python%{1}dist(rich)) = 12.5.1
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(typing-extensions)) = 4.0.1
Provides: bundled(python%{1}dist(urllib3)) = 1.26.8
Provides: bundled(python%{1}dist(tomli)) = 2.0.1
Provides: bundled(python%{1}dist(typing-extensions)) = 4.3
Provides: bundled(python%{1}dist(urllib3)) = 1.26.10
Provides: bundled(python%{1}dist(webencodings)) = 0.5.1
}
@ -270,9 +264,6 @@ sed -i '/"sphinxcontrib.towncrier",/d' docs/html/conf.py
# tests expect wheels in here
ln -s %{python_wheel_dir} tests/data/common_wheels
# Remove shebang from files in bundled chardet
grep -lr "^#\!/usr/bin/env python" src/pip/_vendor/chardet/ | xargs sed -i "1d"
# Remove windows executable binaries
rm -v src/pip/_vendor/distlib/*.exe
sed -i '/\.exe/d' setup.py
@ -411,6 +402,10 @@ pytest_k='not completion and
%{python_wheel_dir}/%{python_wheel_name}
%changelog
* Fri Jul 22 2022 Charalampos Stratakis <cstratak@redhat.com> - 22.2-1
- Update to 22.2
Resolves: rhbz#2109468
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 22.0.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

View File

@ -1,4 +1,4 @@
From d4c72aa37d16e19c0f157e86203a66cad32a9c80 Mon Sep 17 00:00:00 2001
From 2c3f3a590ddfc151a456b44a5f96f0f603d178e9 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
@ -23,10 +23,10 @@ Co-Authored-By: Karolina Surma <ksurma@redhat.com>
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
index 151fd6d..f9109cd 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
@@ -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
@ -35,9 +35,9 @@ index 1a5a781..3df4ab2 100644
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()
)
@@ -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:
@ -53,10 +53,10 @@ index 1a5a781..3df4ab2 100644
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 02dbda1..a952357 100644
index a1e376c..ed7facf 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -406,7 +406,7 @@ class InstallRequirement:
@@ -416,7 +416,7 @@ class InstallRequirement:
f"lack sys.path precedence to {existing_dist.raw_name} "
f"in {existing_dist.location}"
)
@ -66,10 +66,10 @@ index 02dbda1..a952357 100644
else:
if self.editable:
diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py
index 8c149d4..a944906 100644
index fb49d41..040f2c1 100644
--- a/src/pip/_internal/resolution/legacy/resolver.py
+++ b/src/pip/_internal/resolution/legacy/resolver.py
@@ -203,7 +203,9 @@ class Resolver(BaseResolver):
@@ -325,7 +325,9 @@ class Resolver(BaseResolver):
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
@ -81,7 +81,7 @@ index 8c149d4..a944906 100644
req.satisfied_by = None
diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py
index 261d8d5..d1b7728 100644
index a4c24b5..e7e2da9 100644
--- a/src/pip/_internal/resolution/resolvelib/factory.py
+++ b/src/pip/_internal/resolution/resolvelib/factory.py
@@ -1,6 +1,8 @@
@ -93,7 +93,7 @@ index 261d8d5..d1b7728 100644
from typing import (
TYPE_CHECKING,
Dict,
@@ -564,6 +566,16 @@ class Factory:
@@ -549,6 +551,16 @@ class Factory:
if dist is None: # Not installed, no uninstallation required.
return None
@ -111,5 +111,5 @@ index 261d8d5..d1b7728 100644
# be uninstalled, no matter it's in global or user site, because the
# user site installation has precedence over global.
--
2.35.1
2.35.3

View File

@ -1 +1 @@
SHA512 (pip-22.0.4.tar.gz) = af6d1787b4fe97f2eec9c2e3e3f0f756efca8cb83f6ecdae797986fb6050ee60d872a8a8eb7502a32c4334fc0c7af8cf3c58ce980407d0e9f89eec28a4290093
SHA512 (pip-22.2.tar.gz) = 2ff3f9c2dc84c65c14c978e8c58cd3cee6cfff9753655c726763d6d7780d147479f32c47873d402ad9e0821fef940b971a7df93fabd6b998f07dea5af1251c9b