diff options
author | Segev Finer <segev208@gmail.com> | 2017-08-03 21:39:59 +0300 |
---|---|---|
committer | Segev Finer <segev208@gmail.com> | 2017-08-03 21:43:37 +0300 |
commit | 300c8802ef4d13d9433af3bce9d22936ff3c610f (patch) | |
tree | f0e7fd2b767911c64b86ef5e5c85731e61f5824d | |
parent | 54e6a1cd8565c0130024fd68fd628d36fa0ec1c9 (diff) | |
download | external_python_setuptools-300c8802ef4d13d9433af3bce9d22936ff3c610f.tar.gz external_python_setuptools-300c8802ef4d13d9433af3bce9d22936ff3c610f.tar.bz2 external_python_setuptools-300c8802ef4d13d9433af3bce9d22936ff3c610f.zip |
Fix exception on mingw built Python 2
msvc9compiler doesn't like being imported on mingw built Python. It
throws DistutilsPlatformError, so catch it.
Fixes #1118
-rw-r--r-- | setuptools/monkey.py | 9 | ||||
-rw-r--r-- | setuptools/msvc.py | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/setuptools/monkey.py b/setuptools/monkey.py index 62194595..6d3711ec 100644 --- a/setuptools/monkey.py +++ b/setuptools/monkey.py @@ -4,7 +4,6 @@ Monkey patching of distutils. import sys import distutils.filelist -from distutils.util import get_platform import platform import types import functools @@ -153,13 +152,13 @@ def patch_for_msvc_specialized_compiler(): Patch functions in distutils to use standalone Microsoft Visual C++ compilers. """ - if not get_platform().startswith('win'): - # Compilers only availables on Microsoft Windows - return - # import late to avoid circular imports on Python < 3.5 msvc = import_module('setuptools.msvc') + if platform.system() != 'Windows': + # Compilers only availables on Microsoft Windows + return + def patch_params(mod_name, func_name): """ Prepare the parameters for patch_func to patch indicated function. diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 729021ac..f3917815 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -47,7 +47,7 @@ else: try: from distutils.msvc9compiler import Reg -except ImportError: +except (ImportError, distutils.errors.DistutilsPlatformError): pass |