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