summarylogtreecommitdiffstats
path: root/0027-MINGW-customize-site.patch
blob: 215c3947dac4fa7d1718e04f2132136084f219fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 7edbdbe649d050d6753289b61ad5d2883b5338cd 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 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Lib/site.py b/Lib/site.py
index 9e617af..b344f03 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -251,7 +251,8 @@ def _getuserbase():
     def joinuser(*args):
         return os.path.expanduser(os.path.join(*args))
 
-    if os.name == "nt":
+    from sysconfig import _POSIX_BUILD
+    if os.name == "nt" and not _POSIX_BUILD:
         base = os.environ.get("APPDATA") or "~"
         return joinuser(base, "Python")
 
@@ -266,7 +267,8 @@ def _getuserbase():
 def _get_path(userbase):
     version = sys.version_info
 
-    if os.name == 'nt':
+    from sysconfig import _POSIX_BUILD
+    if sys.platform == 'win32' and not _POSIX_BUILD:
         return f'{userbase}\\Python{version[0]}{version[1]}\\site-packages'
 
     if sys.platform == 'darwin' and sys._framework:
@@ -329,6 +331,7 @@ def getsitepackages(prefixes=None):
     if prefixes is None:
         prefixes = PREFIXES
 
+    from sysconfig import _POSIX_BUILD
     for prefix in prefixes:
         if not prefix or prefix in seen:
             continue
@@ -338,7 +341,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],
-- 
2.33.0