Skip to content

Commit

Permalink
python3: Implement handling ".mc" files in cygwin compiler that used …
Browse files Browse the repository at this point in the history
…by mingw
  • Loading branch information
Alexpux committed Jul 30, 2019
1 parent f4ff033 commit 240d923
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
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] +
6 changes: 5 additions & 1 deletion mingw-w64-python3/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ conflicts=("${MINGW_PACKAGE_PREFIX}-python3-virtualenv")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-virtualenv")
_pybasever=3.7
pkgver=${_pybasever}.4
pkgrel=3
pkgrel=4
pkgdesc="A high-level scripting language (mingw-w64)"
arch=('any')
license=('PSF')
Expand Down Expand Up @@ -136,6 +136,7 @@ source=("https://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz
2051-set-venv-activate-path-unix.patch
2052-venv-remove-msys-from-env-and-add-exe-prefix.patch
2060-pass-gen-profile-ldflags.patch
2070-distutils-add-windmc-to-cygwinccompiler.patch
smoketests.py)

# Helper macros to help make tasks easier #
Expand Down Expand Up @@ -308,6 +309,8 @@ prepare() {
apply_patch_with_msg 2052-venv-remove-msys-from-env-and-add-exe-prefix.patch

apply_patch_with_msg 2060-pass-gen-profile-ldflags.patch

apply_patch_with_msg 2070-distutils-add-windmc-to-cygwinccompiler.patch

autoreconf -vfi

Expand Down Expand Up @@ -575,4 +578,5 @@ sha256sums=('fb799134b868199930b75f26678f18932214042639cd52b16da7fd134cd9b13f'
'6ee9095eb78c88c205e225c0e8a0b169f5498c62d6531a2d3199450d0fe895e5'
'09c9f8e14c1f54a1242f4db21af4a014d414fd72b3a92241842965f550f75472'
'180fd0a8f4d24ed7e50eb7916548f7fe398811a76063b043efdf7ab18602c55b'
'48852b3c463d3a5b614ecc2491a480cb2cdc1cc4d6b62800cb999833a269b6fa'
'821402ddaef92140c70041b007bcf15e1cd5fe0fdb9f4f612da868382cc24585')

0 comments on commit 240d923

Please sign in to comment.