diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2016-08-19 15:29:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-19 15:29:42 -0400 |
| commit | 5c940cc9d2e40a2f6717dd23e95342bad32a3b26 (patch) | |
| tree | 452f6f65fbcad9e3fcfdfcabb52270a6befb15bd | |
| parent | ac10f58a5705f266dbba4ac006df15392da8ce87 (diff) | |
| parent | 8d1eecaef52a1baf2b9fc6c772880d8c537b562f (diff) | |
| download | python-setuptools-git-5c940cc9d2e40a2f6717dd23e95342bad32a3b26.tar.gz | |
Merge pull request #739 from JGoutin/patch-1
numpy.distutils and distutils._msvccompiler compatibility
| -rw-r--r-- | CHANGES.rst | 12 | ||||
| -rw-r--r-- | setuptools/msvc.py | 29 |
2 files changed, 35 insertions, 6 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index bffad4c5..9f098df9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,11 @@ CHANGES ======= +v25.3.1 +------- + +* #739 Fix unquoted libpaths by fixing compatibility between `numpy.distutils` and `distutils._msvccompiler` for numpy < 1.11.2 (Fix issue #728, error also fixed in Numpy). + v25.3.0 ------- @@ -16,20 +21,21 @@ v25.2.0 v25.1.6 ------- -* #725 +* #725: revert `library_dir_option` patch (Error is related to `numpy.distutils` and make errors on non Numpy users). v25.1.5 ------- * #720 -* #723 +* #723: Improve patch for `library_dir_option`. v25.1.4 ------- * #717 * #713 -* #707 via #715 +* #707: Fix Python 2 compatibility for MSVC by catching errors properly. +* #715: Fix unquoted libpaths by patching `library_dir_option`. v25.1.3 ------- diff --git a/setuptools/msvc.py b/setuptools/msvc.py index 4616d4be..bffaa6aa 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -2,9 +2,11 @@ This module adds improved support for Microsoft Visual C++ compilers. """ import os +import sys import platform import itertools import distutils.errors +from distutils.version import StrictVersion from setuptools.extern.six.moves import filterfalse @@ -75,14 +77,21 @@ 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: + # Patch distutils._msvccompiler.gen_lib_options for Numpy + unpatched['msvc14_gen_lib_options'] = msvc14compiler.gen_lib_options + msvc14compiler.gen_lib_options = msvc14_gen_lib_options + except NameError: pass @@ -212,6 +221,19 @@ def msvc14_get_vc_env(plat_spec): raise +def msvc14_gen_lib_options(*args, **kwargs): + """ + Patched "distutils._msvccompiler.gen_lib_options" for fix + compatibility between "numpy.distutils" and "distutils._msvccompiler" + (for Numpy < 1.11.2) + """ + if "numpy.distutils" in sys.modules: + import numpy as np + if StrictVersion(np.__version__) < StrictVersion('1.11.2'): + return np.distutils.ccompiler.gen_lib_options(*args, **kwargs) + return unpatched['msvc14_gen_lib_options'](*args, **kwargs) + + def _augment_exception(exc, version, arch=''): """ Add details to the exception message to help guide the user @@ -243,7 +265,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, ) |
