Blob Blame History Raw
diff -rupN Python-2.7.13/Lib/distutils/ccompiler.py Python-2.7.13-new/Lib/distutils/ccompiler.py
--- Python-2.7.13/Lib/distutils/ccompiler.py	2016-12-17 21:05:05.000000000 +0100
+++ Python-2.7.13-new/Lib/distutils/ccompiler.py	2017-01-21 01:46:08.291588498 +0100
@@ -15,7 +15,7 @@ from distutils.spawn import spawn
 from distutils.file_util import move_file
 from distutils.dir_util import mkpath
 from distutils.dep_util import newer_group
-from distutils.util import split_quoted, execute
+from distutils.util import split_quoted, execute, get_platform
 from distutils import log
 # following import is for backward compatibility
 from distutils.sysconfig import customize_compiler
@@ -919,6 +919,8 @@ def get_default_compiler(osname=None, pl
         osname = os.name
     if platform is None:
         platform = sys.platform
+    if get_platform().startswith('mingw'):
+        return 'mingw32'
     for pattern, compiler in _default_compilers:
         if re.match(pattern, platform) is not None or \
            re.match(pattern, osname) is not None:
diff -rupN Python-2.7.13/Lib/distutils/cygwinccompiler.py Python-2.7.13-new/Lib/distutils/cygwinccompiler.py
--- Python-2.7.13/Lib/distutils/cygwinccompiler.py	2016-12-17 21:05:05.000000000 +0100
+++ Python-2.7.13-new/Lib/distutils/cygwinccompiler.py	2017-01-21 01:46:08.291588498 +0100
@@ -271,12 +271,17 @@ class CygwinCCompiler (UnixCCompiler):
         if output_dir is None: output_dir = ''
         obj_names = []
         for src_name in source_filenames:
-            # use normcase to make sure '.rc' is really '.rc' and not '.RC'
-            (base, ext) = os.path.splitext (os.path.normcase(src_name))
+            base, ext = os.path.splitext(src_name)
+            # use 'normcase' only for resource suffixes
+            ext_normcase = os.path.normcase(ext)
+            if ext_normcase in ['.rc','.res']:
+                ext = ext_normcase
             if ext not in (self.src_extensions + ['.rc','.res']):
                 raise UnknownFileError, \
                       "unknown file type '%s' (from '%s')" % \
                       (ext, src_name)
+            base = os.path.splitdrive(base)[1] # Chop off the drive
+            base = base[os.path.isabs(base):]  # If abs, chop off leading /
             if strip_dir:
                 base = os.path.basename (base)
             if ext == '.res' or ext == '.rc':
@@ -340,7 +345,7 @@ class Mingw32CCompiler (CygwinCCompiler)
 
         # Include the appropriate MSVC runtime library if Python was built
         # with MSVC 7.0 or later.
-        self.dll_libraries = get_msvcr()
+        self.dll_libraries = get_msvcr() or []
 
     # __init__ ()