Skip to content

Commit 0225b2a

Browse files
authored
Merge pull request #10503 from uranusjr/locations-detect-python-build
2 parents cb2d4b8 + d6f26d9 commit 0225b2a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

news/10270.removal.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Suppress location mismatch warnings when pip is invoked from a Python source
2+
tree, so ``ensurepip`` does not emit warnings on CPython ``make install``.

src/pip/_internal/locations/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,18 @@ def get_scheme(
303303
if skip_msys2_mingw_bug:
304304
continue
305305

306+
# CPython's POSIX install script invokes pip (via ensurepip) against the
307+
# interpreter located in the source tree, not the install site. This
308+
# triggers special logic in sysconfig that's not present in distutils.
309+
# https://github.com/python/cpython/blob/8c21941ddaf/Lib/sysconfig.py#L178-L194
310+
skip_cpython_build = (
311+
sysconfig.is_python_build(check_home=True)
312+
and not WINDOWS
313+
and k in ("headers", "include", "platinclude")
314+
)
315+
if skip_cpython_build:
316+
continue
317+
306318
warning_contexts.append((old_v, new_v, f"scheme.{k}"))
307319

308320
if not warning_contexts:

0 commit comments

Comments
 (0)