Commit 5c940cc9 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #739 from JGoutin/patch-1

numpy.distutils and distutils._msvccompiler compatibility
parents ac10f58a 8d1eecae
......@@ -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
-------
......
......@@ -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, )
......
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