aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/msvc.py
diff options
context:
space:
mode:
authorJ. Goutin <JGoutin@users.noreply.github.com>2016-08-16 12:43:16 +0200
committerGitHub <noreply@github.com>2016-08-16 12:43:16 +0200
commit5e1693d225b2416712e11da591f60c085ce62957 (patch)
treecf9099bd4ab3a34ff296093ce27967ab8b196f90 /setuptools/msvc.py
parent0addcafeb1c80ba1ffc57756ffe7e3f0210cee1f (diff)
downloadexternal_python_setuptools-5e1693d225b2416712e11da591f60c085ce62957.tar.gz
external_python_setuptools-5e1693d225b2416712e11da591f60c085ce62957.tar.bz2
external_python_setuptools-5e1693d225b2416712e11da591f60c085ce62957.zip
numpy.distutils and distutils._msvccompiler compatibility
- Fix compatibility between `numpy.distutils` and `distutils._msvccompiler`. See #728 : Setuptools 24 `msvc.py` improvement import `distutils._msvccompiler` (New Python 3.5 C compiler for MSVC >= 14), but this one is not compatible with `numpy.distutils` (because not patched with `numpy.distutils.ccompiler.gen_lib_options`) and return unquoted libpaths when linking. The problem was patched in Numpy, but need to be patched also in Setuptools for compatibility between older versions of Numpy and `distutils._msvccompiler` (and indirectly Setuptools > 24). - Replace some residuals `except Exception`.
Diffstat (limited to 'setuptools/msvc.py')
-rw-r--r--setuptools/msvc.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index 4616d4be..bd486fa1 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -75,14 +75,23 @@ def patch_for_specialized_compiler():
msvc9compiler.find_vcvarsall = msvc9_find_vcvarsall
unpatched['msvc9_query_vcvarsall'] = msvc9compiler.query_vcvarsall
msvc9compiler.query_vcvarsall = msvc9_query_vcvarsall
- except Exception:
+ except NameError:
pass
try:
# Patch distutils._msvccompiler._get_vc_env
unpatched['msvc14_get_vc_env'] = msvc14compiler._get_vc_env
msvc14compiler._get_vc_env = msvc14_get_vc_env
- except Exception:
+ except NameError:
+ pass
+
+ try:
+ # Apply "gen_lib_options" patch from Numpy to "distutils._msvccompiler"
+ # to fix compatibility between "numpy.distutils" and
+ # "distutils._msvccompiler" (for Numpy < 1.11.2)
+ import numpy.distutils as np_distutils
+ msvc14compiler.gen_lib_options = np_distutils.ccompiler.gen_lib_options
+ except (ImportError, NameError):
pass
@@ -243,7 +252,8 @@ def _augment_exception(exc, version, arch=''):
elif version >= 14.0:
# For VC++ 14.0 Redirect user to Visual C++ Build Tools
message += (' Get it with "Microsoft Visual C++ Build Tools": '
- r'http://landinghub.visualstudio.com/visual-cpp-build-tools')
+ r'http://landinghub.visualstudio.com/'
+ 'visual-cpp-build-tools')
exc.args = (message, )