Files
MINGW-packages/mingw-w64-python2/2030-fix-msvc9-import.patch
Christoph Reiter 8a162525a7 python: better compatibility with unpatched setuptools. Fixes #5155
We currently patch setuptools itself to not import distutils.msvc9compiler,
which fails because it fails to detect the msvc version and falls back to an unsupported
version 6 and raises.

This doesn't help much in case setuptools is installed through pip which doesn't contain
the fix.

This fixes msvc9compiler.py instead to not fail on import but at the compiler instance creation,
i.e. the point where the version is actually used. The setuptools fix remains for now to make
updates easier.

Fixes #5155
2019-04-21 16:40:58 +02:00

24 lines
977 B
Diff

setuptools imports it and VERSION is 6 with a mingw Python. Move the version
check to the actual compiler instance creation, which is also the only place
where it's used.
--- Python-3.7.3/Lib/distutils/msvc9compiler.py.orig 2019-03-25 21:21:05.000000000 +0100
+++ Python-3.7.3/Lib/distutils/msvc9compiler.py 2019-04-21 15:56:16.997090000 +0200
@@ -292,8 +292,6 @@
# More globals
VERSION = get_build_version()
-if VERSION < 8.0:
- raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
# MACROS = MacroExpander(VERSION)
class MSVCCompiler(CCompiler) :
@@ -328,6 +326,8 @@
def __init__(self, verbose=0, dry_run=0, force=0):
CCompiler.__init__ (self, verbose, dry_run, force)
+ if VERSION < 8.0:
+ raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
self.__version = VERSION
self.__root = r"Software\Microsoft\VisualStudio"
# self.__macros = MACROS