Commit 300c8802 authored by Segev Finer's avatar Segev Finer

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
parent 54e6a1cd
...@@ -4,7 +4,6 @@ Monkey patching of distutils. ...@@ -4,7 +4,6 @@ Monkey patching of distutils.
import sys import sys
import distutils.filelist import distutils.filelist
from distutils.util import get_platform
import platform import platform
import types import types
import functools import functools
...@@ -153,13 +152,13 @@ def patch_for_msvc_specialized_compiler(): ...@@ -153,13 +152,13 @@ def patch_for_msvc_specialized_compiler():
Patch functions in distutils to use standalone Microsoft Visual C++ Patch functions in distutils to use standalone Microsoft Visual C++
compilers. compilers.
""" """
if not get_platform().startswith('win'):
# Compilers only availables on Microsoft Windows
return
# import late to avoid circular imports on Python < 3.5 # import late to avoid circular imports on Python < 3.5
msvc = import_module('setuptools.msvc') msvc = import_module('setuptools.msvc')
if platform.system() != 'Windows':
# Compilers only availables on Microsoft Windows
return
def patch_params(mod_name, func_name): def patch_params(mod_name, func_name):
""" """
Prepare the parameters for patch_func to patch indicated function. Prepare the parameters for patch_func to patch indicated function.
......
...@@ -47,7 +47,7 @@ else: ...@@ -47,7 +47,7 @@ else:
try: try:
from distutils.msvc9compiler import Reg from distutils.msvc9compiler import Reg
except ImportError: except (ImportError, distutils.errors.DistutilsPlatformError):
pass pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment