-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python3: Implement handling ".mc" files in cygwin compiler that used …
…by mingw
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
mingw-w64-python3/2070-distutils-add-windmc-to-cygwinccompiler.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- Python-3.7.4/Lib/distutils/cygwinccompiler.py.orig 2019-07-30 08:57:41.678747200 +0300 | ||
+++ Python-3.7.4/Lib/distutils/cygwinccompiler.py 2019-07-30 09:02:39.593070700 +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] + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters