Files
MINGW-packages/mingw-w64-python/0027-MINGW-customize-site.patch
Christoph Reiter 4177c0198b python: Update to 3.10.8
See https://github.com/msys2-contrib/cpython-mingw/pull/110

update-patches: remove git version signature to keep the diff smaller
2022-10-15 15:57:24 +02:00

60 lines
1.9 KiB
Diff

From 78fdf2b59b174a94b430ec82987fa8aeb5656f13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
<alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:51:42 +0530
Subject: [PATCH 027/N] MINGW customize site
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Алексей <alexey.pawlow@gmail.com>
Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>
---
Lib/site.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/Lib/site.py b/Lib/site.py
index 939893e..e460a3d 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -88,6 +88,12 @@ USER_SITE = None
USER_BASE = None
+# Same as defined in Lib/sysconfig.py
+# redeclared since sysconfig is large for site.
+# GCC[mingw*] use posix build system
+_POSIX_BUILD = os.name == 'posix' or \
+ (os.name == "nt" and 'GCC' in sys.version)
+
def _trace(message):
if sys.flags.verbose:
print(message, file=sys.stderr)
@@ -273,7 +279,7 @@ def _getuserbase():
def joinuser(*args):
return os.path.expanduser(os.path.join(*args))
- if os.name == "nt":
+ if os.name == "nt" and not _POSIX_BUILD:
base = os.environ.get("APPDATA") or "~"
return joinuser(base, "Python")
@@ -288,7 +294,7 @@ def _getuserbase():
def _get_path(userbase):
version = sys.version_info
- if os.name == 'nt':
+ if os.name == 'nt' and not _POSIX_BUILD:
ver_nodot = sys.winver.replace('.', '')
return f'{userbase}\\Python{ver_nodot}\\site-packages'
@@ -365,7 +371,7 @@ def getsitepackages(prefixes=None):
if sys.platlibdir != "lib":
libdirs.append("lib")
- if os.sep == '/':
+ if _POSIX_BUILD:
for libdir in libdirs:
path = os.path.join(prefix, libdir,
"python%d.%d" % sys.version_info[:2],