From 5e1693d225b2416712e11da591f60c085ce62957 Mon Sep 17 00:00:00 2001 From: "J. Goutin" Date: Tue, 16 Aug 2016 12:43:16 +0200 Subject: 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`. --- setuptools/msvc.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'setuptools/msvc.py') 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, ) -- cgit v1.2.3