commit: e37479ca70ec02f12f50d071efb3927c29942808
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu May 22 12:14:39 2025 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu May 22 12:14:39 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e37479ca
dev-python/build: Backport a crash fix for non-installed pip
Backport a fix to my unvendored pip support patch that fixes a crash
when dev-python/pip is not installed at all.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
...uild-1.2.2_p1-r1.ebuild => build-1.2.2_p1-r2.ebuild} | 1 +
dev-python/build/files/build-1.2.2_p1-gentoo-pip.patch | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dev-python/build/build-1.2.2_p1-r1.ebuild
b/dev-python/build/build-1.2.2_p1-r2.ebuild
similarity index 98%
rename from dev-python/build/build-1.2.2_p1-r1.ebuild
rename to dev-python/build/build-1.2.2_p1-r2.ebuild
index eeca8a114deb..482458135053 100644
--- a/dev-python/build/build-1.2.2_p1-r1.ebuild
+++ b/dev-python/build/build-1.2.2_p1-r2.ebuild
@@ -54,6 +54,7 @@ distutils_enable_tests pytest
PATCHES=(
# https://github.com/pypa/build/pull/861
+ # https://github.com/pypa/build/pull/898
"${FILESDIR}/${P}-gentoo-pip.patch"
)
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
index 4335500e73a8..262131705776 100644
--- 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
@@ -1,8 +1,8 @@
diff --git a/src/build/env.py b/src/build/env.py
-index b8c7b5f6..f10cf4bf 100644
+index e583e68..ae5177b 100644
--- a/src/build/env.py
+++ b/src/build/env.py
-@@ -11,6 +11,7 @@
+@@ -11,6 +11,7 @@ import sys
import sysconfig
import tempfile
import typing
@@ -10,10 +10,16 @@ index b8c7b5f6..f10cf4bf 100644
from collections.abc import Collection, Mapping
-@@ -158,6 +159,15 @@ def _has_valid_outer_pip(self) -> bool | None:
+@@ -158,8 +159,21 @@ class _PipBackend(_EnvBackend):
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.
"""
++
+ # Version to have added the `--python` option.
+- return _has_dependency('pip', '22.3')
++ if not _has_dependency('pip', '22.3'): # pragma: no cover
++ return False
++
+ # `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,
@@ -23,6 +29,7 @@ index b8c7b5f6..f10cf4bf 100644
+ 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')
++ return True
+ @functools.cached_property
+ def _has_virtualenv(self) -> bool: