| 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:02:17.798078800 +0300 |
| +++ Python-3.8.0/Lib/distutils/cygwinccompiler.py 2019-10-22 10:03:04.738561200 +0300 |
| @@ -58,6 +58,7 @@ |
| from distutils import log |
| from distutils.version import LooseVersion |
| from distutils.spawn import find_executable |
| +from subprocess import Popen, PIPE, check_output |
| |
| def get_msvcr(): |
| """Include the appropriate MSVC runtime library if Python was built |
| @@ -373,7 +374,7 @@ |
| return (CONFIG_H_UNCERTAIN, |
| "couldn't read '%s': %s" % (fn, exc.strerror)) |
| |
| -RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)') |
| +RE_VERSION = re.compile(br'[\D\s]*(\d+\.\d+(\.\d+)*)[\D\s]*$') |
| |
| def _find_exe_version(cmd): |
| """Find the version of an executable by running `cmd` in the shell. |
| @@ -402,7 +403,16 @@ |
| |
| If not possible it returns None for it. |
| """ |
| - commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] |
| + gcc = os.environ.get('CC') or 'gcc' |
| + ld = 'ld' |
| + out = Popen(gcc+' --print-prog-name ld', shell=True, stdout=PIPE).stdout |
| + try: |
| + ld = test=str(out.read(),encoding='utf-8').strip() |
| + finally: |
| + out.close() |
| + dllwrap = os.environ.get('DLLWRAP') or 'dllwrap' |
| + # MinGW64 doesn't have i686-w64-mingw32-ld, so instead we ask gcc. |
| + commands = [gcc+' -dumpversion', ld+' -v', dllwrap+' --version'] |
| return tuple([_find_exe_version(cmd) for cmd in commands]) |
| |
| def is_cygwingcc(): |
| diff -Naur Python-3.8.0-orig/Modules/Setup.config.in Python-3.8.0/Modules/Setup.config.in |
| --- Python-3.8.0-orig/Modules/Setup.config.in 2019-10-22 10:02:55.456544900 +0300 |
| +++ Python-3.8.0/Modules/Setup.config.in 2019-10-22 10:03:05.159762000 +0300 |
| @@ -12,4 +12,5 @@ |
| # build-in modules for windows platform: |
| @USE_WIN32_MODULE@winreg ../PC/winreg.c |
| @USE_WIN32_MODULE@msvcrt -DPy_BUILD_CORE ../PC/msvcrtmodule.c |
| +@USE_WIN32_MODULE@_winapi _winapi.c |
| |
| diff -Naur Python-3.8.0-orig/setup.py Python-3.8.0/setup.py |
| --- Python-3.8.0-orig/setup.py 2019-10-22 10:02:35.597710000 +0300 |
| +++ Python-3.8.0/setup.py 2019-10-22 10:03:05.939763300 +0300 |
| @@ -1545,7 +1545,9 @@ |
| self.add(Extension('msvcrt', [os.path.join(pc_srcdir, p) |
| for p in ['msvcrtmodule.c']])) |
| |
| - self.add(Extension('_winapi', ['_winapi.c'])) |
| + # Added to Setup.config.in as now needed earlier since I |
| + # use subprocess (which uses Popen) in cygwinccompiler.py |
| + # self.add(Extension('_winapi', ['_winapi.c'])) |
| |
| self.add(Extension('_msi', [os.path.join(pc_srcdir, p) |
| for p in ['_msi.c']], |