From 240d92366618714d270d7236f35ebff450bd763d Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Tue, 30 Jul 2019 09:57:25 +0300 Subject: [PATCH] python3: Implement handling ".mc" files in cygwin compiler that used by mingw --- ...tutils-add-windmc-to-cygwinccompiler.patch | 31 +++++++++++++++++++ mingw-w64-python3/PKGBUILD | 6 +++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-python3/2070-distutils-add-windmc-to-cygwinccompiler.patch diff --git a/mingw-w64-python3/2070-distutils-add-windmc-to-cygwinccompiler.patch b/mingw-w64-python3/2070-distutils-add-windmc-to-cygwinccompiler.patch new file mode 100644 index 0000000000000..a5d35b61d4cad --- /dev/null +++ b/mingw-w64-python3/2070-distutils-add-windmc-to-cygwinccompiler.patch @@ -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] + diff --git a/mingw-w64-python3/PKGBUILD b/mingw-w64-python3/PKGBUILD index f6c85a0b5433f..a26cc0b29ef16 100644 --- a/mingw-w64-python3/PKGBUILD +++ b/mingw-w64-python3/PKGBUILD @@ -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') @@ -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 # @@ -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 @@ -575,4 +578,5 @@ sha256sums=('fb799134b868199930b75f26678f18932214042639cd52b16da7fd134cd9b13f' '6ee9095eb78c88c205e225c0e8a0b169f5498c62d6531a2d3199450d0fe895e5' '09c9f8e14c1f54a1242f4db21af4a014d414fd72b3a92241842965f550f75472' '180fd0a8f4d24ed7e50eb7916548f7fe398811a76063b043efdf7ab18602c55b' + '48852b3c463d3a5b614ecc2491a480cb2cdc1cc4d6b62800cb999833a269b6fa' '821402ddaef92140c70041b007bcf15e1cd5fe0fdb9f4f612da868382cc24585')