summaryrefslogtreecommitdiff
path: root/dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2025-02-19 14:24:44 +0100
committerMichał Górny <mgorny@gentoo.org>2025-02-19 15:34:18 +0100
commitcd58e32401e6e898830b6d051c5e9e7c9acd1831 (patch)
tree897aebb8edb919ff99723317c7d44f4e5d168a00 /dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch
parent5cf9af501df31a95045b3737850603750ded77b3 (diff)
downloadgentoo-cd58e32401e6e898830b6d051c5e9e7c9acd1831.tar.gz
gentoo-cd58e32401e6e898830b6d051c5e9e7c9acd1831.tar.bz2
gentoo-cd58e32401e6e898830b6d051c5e9e7c9acd1831.zip
dev-python/build: Add a patch to support unbundled pip
Bug: https://bugs.gentoo.org/934922 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch')
-rw-r--r--dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch b/dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch
new file mode 100644
index 000000000000..4335500e73a8
--- /dev/null
+++ b/dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch
@@ -0,0 +1,28 @@
+diff --git a/src/build/env.py b/src/build/env.py
+index b8c7b5f6..f10cf4bf 100644
+--- a/src/build/env.py
++++ b/src/build/env.py
+@@ -11,6 +11,7 @@
+ import sysconfig
+ import tempfile
+ import typing
++import warnings
+
+ from collections.abc import Collection, Mapping
+
+@@ -158,6 +159,15 @@ def _has_valid_outer_pip(self) -> bool | None:
+ This checks for a valid global pip. Returns None if pip is missing, False
+ if pip is too old, and True if it can be used.
+ """
++ # `pip install --python` is nonfunctional on Gentoo debundled pip.
++ # Detect that by checking if pip._vendor` module exists. However,
++ # searching for pip could yield warnings from _distutils_hack,
++ # so silence them.
++ with warnings.catch_warnings():
++ warnings.simplefilter('ignore')
++ if importlib.util.find_spec('pip._vendor') is None:
++ return False # pragma: no cover
++
+ # Version to have added the `--python` option.
+ return _has_dependency('pip', '22.3')
+