From e47ce899adcbb0fcf43572bbe1d40bea39dacbc2 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?= 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: Алексей Co-authored-by: Christoph Reiter --- 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],