bpo-42856: Add --with-wheel-pkg-dir=PATH configure option by vstinner · Pull Request #24210 · python/cpython
I tested manually 3 cases using test_ensurepip.
I added logs to see which packages are used with log.patch file:
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
index 8b000f93db..292b47002a 100644
--- a/Lib/ensurepip/__init__.py
+++ b/Lib/ensurepip/__init__.py
@@ -162,10 +162,12 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
from ensurepip import _bundled
wheel_name = package.wheel_name
whl = resources.read_binary(_bundled, wheel_name)
+ print("WHEEL: read_binary")
else:
with open(package.filename, "rb") as fp:
whl = fp.read()
wheel_name = os.path.basename(package.filename)
+ print("WHEEL: copy file", package.filename)
filename = os.path.join(tmpdir, wheel_name)
with open(filename, "wb") as fp:
Case 1: only bundled
git clean -fdx
git checkout .
git apply ~/log.patch
./configure --with-pydebug CFLAGS="-O0" && make && ./python -m test -v test_ensurepip
=> OK: BUNDLED is used, test_ensurepip pass
Case 2: only wheel dir
git clean -fdx
git checkout .
git apply ~/log.patch
rm -rf Lib/ensurepip/_bundled/
./configure --with-pydebug CFLAGS="-O0" --with-wheel-pkg-dir=/usr/share/python-wheels && make && ./python -m test -v test_ensurepip
=> OK: WHEEL DIR is used, test_ensurepip pass
Case 3: both, wheel dir + bundled
git clean -fdx
git checkout .
git apply ~/log.patch
./configure --with-pydebug CFLAGS="-O0" --with-wheel-pkg-dir=/usr/share/python-wheels && make && ./python -m test -v test_ensurepip
=> OK: WHEEL DIR is used, test_ensurepip pass