From 5184798217f652bd89f5d3a7a2e50dfefe2bfbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 4 Jul 2026 16:29:34 +0200 Subject: [PATCH] dev-python/ensurepip-pip: Enable testing on py3.15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- .../ensurepip-pip/ensurepip-pip-26.1.2.ebuild | 8 ++- .../files/pip-26.1.2-py315.patch | 49 +++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 dev-python/ensurepip-pip/files/pip-26.1.2-py315.patch diff --git a/dev-python/ensurepip-pip/ensurepip-pip-26.1.2.ebuild b/dev-python/ensurepip-pip/ensurepip-pip-26.1.2.ebuild index 9d0a4f611a421..66d10c7f33e9f 100644 --- a/dev-python/ensurepip-pip/ensurepip-pip-26.1.2.ebuild +++ b/dev-python/ensurepip-pip/ensurepip-pip-26.1.2.ebuild @@ -3,9 +3,9 @@ EAPI=8 -DISTUTILS_USE_PEP517=flit +DISTUTILS_USE_PEP517=flit-core # PYTHON_COMPAT is used only for testing -PYTHON_COMPAT=( pypy3_11 python3_{11..14} ) +PYTHON_COMPAT=( python3_{12..15} ) PYTHON_REQ_USE="ssl(+),threads(+)" inherit distutils-r1 pypi @@ -83,6 +83,10 @@ python_prepare_all() { # remove coverage & pytest-subket wheel expectation from test suite # (from dev-python/pip) "${FILESDIR}/pip-26.0-test-wheels.patch" + + # https://github.com/pypa/pip/pull/14033 + # + https://github.com/pypa/pip/commit/4c6d7471dec62fb004a47a7c2164b6b5b089ac06 + "${FILESDIR}/pip-26.1.2-py315.patch" ) distutils-r1_python_prepare_all diff --git a/dev-python/ensurepip-pip/files/pip-26.1.2-py315.patch b/dev-python/ensurepip-pip/files/pip-26.1.2-py315.patch new file mode 100644 index 0000000000000..c36368cc0a73e --- /dev/null +++ b/dev-python/ensurepip-pip/files/pip-26.1.2-py315.patch @@ -0,0 +1,49 @@ +diff --git a/src/pip/_internal/build_env.py b/src/pip/_internal/build_env.py +index 1a42a9d41..7639dabca 100644 +--- a/src/pip/_internal/build_env.py ++++ b/src/pip/_internal/build_env.py +@@ -468,15 +468,19 @@ class BuildEnvironment: + """ + import os, site, sys + +- # First, drop system-sites related paths. ++ # First, discover all system-sites related paths. + original_sys_path = sys.path[:] ++ # Clear sys.path so addsitedir() will add system site paths and paths ++ # added by contained .pth files to sys.path reliably. This is necessary ++ # since Python 3.15, which notably no longer re-executes .pth files for ++ # known paths. ++ sys.path = [] + known_paths = set() + for path in {system_sites!r}: + site.addsitedir(path, known_paths=known_paths) +- system_paths = set( +- os.path.normcase(path) +- for path in sys.path[len(original_sys_path):] +- ) ++ system_paths = set(os.path.normcase(path) for path in sys.path) ++ ++ # Drop discovered system-sites related paths. + original_sys_path = [ + path for path in original_sys_path + if os.path.normcase(path) not in system_paths +diff --git a/tests/lib/venv.py b/tests/lib/venv.py +index 67b01d9f3..4e86b92b3 100644 +--- a/tests/lib/venv.py ++++ b/tests/lib/venv.py +@@ -174,11 +174,13 @@ class VirtualEnvironment: + site.ENABLE_USER_SITE = {self._user_site_packages} + # First, drop system-sites related paths. + original_sys_path = sys.path[:] ++ # To discover system-sites related paths, clear sys.path ++ # and build a new one with only system paths. ++ sys.path = [] + known_paths = set() + for path in site.getsitepackages(): + site.addsitedir(path, known_paths=known_paths) +- system_paths = sys.path[len(original_sys_path):] +- for path in system_paths: ++ for path in sys.path: + if path in original_sys_path: + original_sys_path.remove(path) + sys.path = original_sys_path