Blame 0480-MINGW-generalization-of-posix-build-in-distutils-sys.patch

ddb6764
diff -rupN Python-2.7.13/Lib/distutils/sysconfig.py Python-2.7.13-new/Lib/distutils/sysconfig.py
ddb6764
--- Python-2.7.13/Lib/distutils/sysconfig.py	2017-01-21 01:46:06.279609979 +0100
ddb6764
+++ Python-2.7.13-new/Lib/distutils/sysconfig.py	2017-01-21 01:46:08.994580992 +0100
ddb6764
@@ -62,6 +62,16 @@ def get_python_version():
ddb6764
     """
ddb6764
     return sys.version[:3]
ddb6764
 
ddb6764
+def _posix_build():
ddb6764
+    # GCC[mingw*] use posix build system
ddb6764
+    # Check for cross builds explicitly
ddb6764
+    host_platform = os.environ.get("_PYTHON_HOST_PLATFORM")
ddb6764
+    if host_platform:
ddb6764
+        if host_platform.startswith('mingw'):
ddb6764
+            return True
ddb6764
+    return os.name == 'posix' or \
ddb6764
+        (os.name == "nt" and 'GCC' in sys.version)
ddb6764
+posix_build = _posix_build()
ddb6764
 
ddb6764
 def get_python_inc(plat_specific=0, prefix=None):
ddb6764
     """Return the directory containing installed Python header files.
ddb6764
@@ -77,7 +87,7 @@ def get_python_inc(plat_specific=0, pref
ddb6764
     if prefix is None:
ddb6764
         prefix = plat_specific and EXEC_PREFIX or PREFIX
ddb6764
 
ddb6764
-    if os.name == "posix":
ddb6764
+    if posix_build:
ddb6764
         if python_build:
ddb6764
             buildir = os.path.dirname(sys.executable)
ddb6764
             if plat_specific:
ddb6764
@@ -118,7 +128,7 @@ def get_python_lib(plat_specific=0, stan
ddb6764
     if prefix is None:
ddb6764
         prefix = plat_specific and EXEC_PREFIX or PREFIX
ddb6764
 
ddb6764
-    if os.name == "posix":
ddb6764
+    if posix_build:
ddb6764
         libpython = os.path.join(prefix,
ddb6764
                                  "lib", "python" + get_python_version())
ddb6764
         if standard_lib:
ddb6764
@@ -240,7 +250,7 @@ def customize_compiler(compiler):
ddb6764
 def get_config_h_filename():
ddb6764
     """Return full pathname of installed pyconfig.h file."""
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
@@ -417,6 +427,9 @@ def _init_posix():
ddb6764
 
ddb6764
 
ddb6764
 def _init_nt():
ddb6764
+    if posix_build:
ddb6764
+        _init_posix()
ddb6764
+        return
ddb6764
     """Initialize the module as appropriate for NT"""
ddb6764
     g = {}
ddb6764
     # set basic install directories