blob: 5f81526a1a4570ab699712b024fec684c5820604 [file] [log] [blame]
diff -Naur Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py Python-3.8.0/Lib/distutils/cygwinccompiler.py
--- Python-3.8.0-orig/Lib/distutils/cygwinccompiler.py 2019-10-22 10:04:07.887472100 +0300
+++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:05:31.254018600 +0300
@@ -165,6 +165,28 @@
self.spawn(["windres", "-i", src, "-o", obj])
except DistutilsExecError as 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 as msg:
+ raise CompileError(msg)
else: # for other files use the C-compiler
try:
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
@@ -259,9 +281,9 @@
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']:
+ if ext_normcase in ['.rc', '.res', '.mc']:
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))
base = os.path.splitdrive(base)[1] # Chop off the drive