Commit 38d67434 authored by J. Goutin's avatar J. Goutin Committed by GitHub

Patch with numpy at execution time and not at import time

parent 4c2b0a2d
......@@ -79,19 +79,17 @@ def patch_for_specialized_compiler():
pass
try:
# Patch distutils._msvccompiler._get_vc_env
# Patch distutils._msvccompiler._get_vc_env for numpy compatibility
unpatched['msvc14_get_vc_env'] = msvc14compiler._get_vc_env
msvc14compiler._get_vc_env = msvc14_get_vc_env
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):
# Patch distutils._msvccompiler.gen_lib_options
unpatched['msvc14_gen_lib_options'] = msvc14compiler.gen_lib_options
msvc14compiler.gen_lib_options = msvc14_gen_lib_options
except NameError:
pass
......@@ -221,6 +219,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" in distutils.ccompiler.CCompiler.spawn.__module__:
import numpy as np
return np.distutils.ccompiler.gen_lib_options(*args, **kwargs)
else:
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
......
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