Blob Blame History Raw
diff -rupN Python-2.7.15/Lib/distutils/cygwinccompiler.py Python-2.7.15-new/Lib/distutils/cygwinccompiler.py
--- Python-2.7.15/Lib/distutils/cygwinccompiler.py	2018-05-02 17:23:35.463731374 +0200
+++ Python-2.7.15-new/Lib/distutils/cygwinccompiler.py	2018-05-02 17:23:37.143731281 +0200
@@ -159,6 +159,28 @@ class CygwinCCompiler (UnixCCompiler):
                 self.spawn(["windres", "-i", src, "-o", obj])
             except DistutilsExecError, msg:
                 raise CompileError, msg
+        elif ext == '.mc':
+            # Adapted from msvc9compiler:
+            #
+            # Compile .MC to .RC file to .RES file.
+            #   * '-h dir' specifies the directory for the generated include file
+            #   * '-r dir' specifies the target directory of the generated RC file and the binary message resource it includes
+            #
+            # For now (since there are no options to change this),
+            # we use the source-directory for the include file and
+            # the build directory for the RC file and message
+            # resources. This works at least for win32all.
+            h_dir = os.path.dirname(src)
+            rc_dir = os.path.dirname(obj)
+            try:
+                # first compile .MC to .RC and .H file
+                self.spawn(['windmc'] + ['-h', h_dir, '-r', rc_dir] + [src])
+                base, _ = os.path.splitext (os.path.basename (src))
+                rc_file = os.path.join (rc_dir, base + '.rc')
+                # then compile .RC to .RES file
+                self.spawn(['windres', '-i', rc_file, '-o', obj])
+            except DistutilsExecError, msg:
+                raise CompileError(msg)
         else: # for other files use the C-compiler
             try:
                 self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
@@ -277,7 +299,7 @@ class CygwinCCompiler (UnixCCompiler):
             ext_normcase = os.path.normcase(ext)
             if ext_normcase in ['.rc','.res']:
                 ext = ext_normcase
-            if ext not in (self.src_extensions + ['.rc','.res']):
+            if ext not in (self.src_extensions + ['.rc', '.res', '.mc']):
                 raise UnknownFileError, \
                       "unknown file type '%s' (from '%s')" % \
                       (ext, src_name)