From 63d0d71bb53f310db69d04e95afc339c993fdba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 12 Nov 2021 13:45:40 +0100 Subject: [PATCH] Allow to decide whether to use distutils or sysconfig with sysconfig._PIP_USE_SYSCONFIG Fixes https://github.com/pypa/pip/issues/10647 --- src/pip/_internal/locations/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pip/_internal/locations/__init__.py b/src/pip/_internal/locations/__init__.py index dba182d7578..62efbe96432 100644 --- a/src/pip/_internal/locations/__init__.py +++ b/src/pip/_internal/locations/__init__.py @@ -45,7 +45,11 @@ _PLATLIBDIR: str = getattr(sys, "platlibdir", "lib") -_USE_SYSCONFIG = sys.version_info >= (3, 10) +# By default, we use sysconfig on Python 3.10+ +# But Python distributors can override this decision by setting: +# sysconfig._PIP_USE_SYSCONFIG = True / False +# Rationale in https://github.com/pypa/pip/issues/10647 +_USE_SYSCONFIG = getattr(sysconfig, "_PIP_USE_SYSCONFIG", sys.version_info >= (3, 10)) def _looks_like_bpo_44860() -> bool: