Files
Michał Korczak 5f624e59eb python-setuptools: update to 84.0.0 (#31469)
* python-setuptools: update to 84.0.0

* use safe patch

* cleanup

* add metadata
2026-09-09 09:31:43 +08:00

42 lines
1.8 KiB
Diff

From b263b1771d81a2d4ef43ee0e2e11461815f78957 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 11 Jan 2026 18:13:43 +0100
Subject: [PATCH] install: correct sysconfig scheme lookup on Windows
distutils by default passes os.name, so "nt", to _resolve_scheme()
which results in the layout key being "", which results in
get_preferred_scheme() raising, and "nt" being returned as as a fallback.
This is not correct in case sysconfig has a different scheme configuration,
or in case we are installing into a venv, where the "venv" scheme should be
selected and not "nt".
Fix by defaulting to the "prefix" layout in case no layout is given.
This gives us "nt" from sysconfig, and "venv" in case we are in a venv.
With CPython the change from "nt" to "venv" doesn't change anything
for distutils since that only means "headers" are missing, which distutils
injects later, resulting in the same scheme paths.
For MINGW Python which defaults to the "posix" scheme this fixes the default
install location (up until now MINGW Python patched the "nt" scheme to work
around this but we want to fix the real issue now)
---
distutils/command/install.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/distutils/command/install.py b/distutils/command/install.py
index 8421d54e0..6d8169e45 100644
--- a/_distutils/command/install.py
+++ b/_distutils/command/install.py
@@ -141,10 +141,10 @@
def _resolve_scheme(name):
_os_name, _sep, key = name.partition('_')
try:
- resolved = sysconfig.get_preferred_scheme(key)
+ resolved = sysconfig.get_preferred_scheme(key or "prefix")
except Exception: # noqa: BLE001 # any failure falls back to the framework scheme
resolved = fw.scheme(name)
return resolved