Blame 0460-MINGW-generalization-of-posix-build-in-sysconfig.py.patch

ddb6764
diff -rupN Python-2.7.13/Lib/sysconfig.py Python-2.7.13-new/Lib/sysconfig.py
ddb6764
--- Python-2.7.13/Lib/sysconfig.py	2017-01-21 01:46:08.289588519 +0100
ddb6764
+++ Python-2.7.13-new/Lib/sysconfig.py	2017-01-21 01:46:08.714583981 +0100
ddb6764
@@ -94,6 +94,10 @@ _EXEC_PREFIX = os.path.normpath(sys.exec
ddb6764
 _CONFIG_VARS = None
ddb6764
 _USER_BASE = None
ddb6764
 
ddb6764
+# GCC[mingw*] use posix build system
ddb6764
+_POSIX_BUILD = os.name == 'posix' or \
ddb6764
+    (os.name == "nt" and 'GCC' in sys.version)
ddb6764
+
ddb6764
 def _safe_realpath(path):
ddb6764
     try:
ddb6764
         return realpath(path)
ddb6764
@@ -162,7 +166,7 @@ def _expand_vars(scheme, vars):
ddb6764
     return res
ddb6764
 
ddb6764
 def _get_default_scheme():
ddb6764
-    if os.name == 'posix':
ddb6764
+    if _POSIX_BUILD:
ddb6764
         # the default scheme for posix is posix_prefix
ddb6764
         return 'posix_prefix'
ddb6764
     return os.name
ddb6764
@@ -173,7 +177,7 @@ def _getuserbase():
ddb6764
         return os.path.expanduser(os.path.join(*args))
ddb6764
 
ddb6764
     # what about 'os2emx', 'riscos' ?
ddb6764
-    if os.name == "nt":
ddb6764
+    if os.name == "nt" and not _POSIX_BUILD:
ddb6764
         base = os.environ.get("APPDATA") or "~"
ddb6764
         return env_base if env_base else joinuser(base, "Python")
ddb6764
 
ddb6764
@@ -418,7 +422,7 @@ def parse_config_h(fp, vars=None):
ddb6764
 def get_config_h_filename():
ddb6764
     """Returns the path of pyconfig.h."""
ddb6764
     if _PYTHON_BUILD:
ddb6764
-        if os.name == "nt":
ddb6764
+        if os.name == "nt" and not _POSIX_BUILD:
ddb6764
             inc_dir = os.path.join(_PROJECT_BASE, "PC")
ddb6764
         else:
ddb6764
             inc_dir = _PROJECT_BASE
ddb6764
@@ -480,9 +484,9 @@ def get_config_vars(*args):
ddb6764
         _CONFIG_VARS['platbase'] = _EXEC_PREFIX
ddb6764
         _CONFIG_VARS['projectbase'] = _PROJECT_BASE
ddb6764
 
ddb6764
-        if os.name in ('nt', 'os2'):
ddb6764
+        if os.name in ('nt', 'os2') and not _POSIX_BUILD:
ddb6764
             _init_non_posix(_CONFIG_VARS)
ddb6764
-        if os.name == 'posix':
ddb6764
+        if _POSIX_BUILD:
ddb6764
             _init_posix(_CONFIG_VARS)
ddb6764
 
ddb6764
         # Setting 'userbase' is done below the call to the
ddb6764
@@ -497,7 +501,7 @@ def get_config_vars(*args):
ddb6764
         # Normally it is relative to the build directory.  However, during
ddb6764
         # testing, for example, we might be running a non-installed python
ddb6764
         # from a different directory.
ddb6764
-        if _PYTHON_BUILD and os.name == "posix":
ddb6764
+        if _PYTHON_BUILD and _POSIX_BUILD:
ddb6764
             base = _PROJECT_BASE
ddb6764
             try:
ddb6764
                 cwd = os.getcwd()