summaryrefslogtreecommitdiff
path: root/numpy/distutils/command/config.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@googlemail.com>2014-07-20 21:39:38 +0200
committerRalf Gommers <ralf.gommers@googlemail.com>2014-07-20 23:20:34 +0200
commitfa0ec11c1e653a51a047ab7b572546886ba3cd8a (patch)
tree1fce97c6eadda7638c533945a589c28cb2154e2b /numpy/distutils/command/config.py
parentfcce0274a683add16a76e1b41288796a27682f9a (diff)
downloadnumpy-fa0ec11c1e653a51a047ab7b572546886ba3cd8a.tar.gz
BLD: fix build issues with MSVC10 on Windows. Closes gh-4245.
Note that there are a few similar patches posted to gh-4101 and gh-4245. Those were all patches to msvc9compiler in Python distutils. Monkeypatching ``MSVCCompiler.link`` is less easy than this change to ``config._check_compiler``; effect should be the same. Also updates the error message shown when initializing MSVC fails. [ci skip]
Diffstat (limited to 'numpy/distutils/command/config.py')
-rw-r--r--numpy/distutils/command/config.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py
index 0086e3632..1b688bdd6 100644
--- a/numpy/distutils/command/config.py
+++ b/numpy/distutils/command/config.py
@@ -59,17 +59,28 @@ class config(old_config):
e = get_exception()
msg = """\
Could not initialize compiler instance: do you have Visual Studio
-installed ? If you are trying to build with mingw, please use python setup.py
-build -c mingw32 instead ). If you have Visual Studio installed, check it is
-correctly installed, and the right version (VS 2008 for python 2.6, VS 2003 for
-2.5, etc...). Original exception was: %s, and the Compiler
-class was %s
+installed? If you are trying to build with MinGW, please use "python setup.py
+build -c mingw32" instead. If you have Visual Studio installed, check it is
+correctly installed, and the right version (VS 2008 for python 2.6, 2.7 and 3.2,
+VS 2010 for >= 3.3).
+
+Original exception was: %s, and the Compiler class was %s
============================================================================""" \
% (e, self.compiler.__class__.__name__)
print ("""\
============================================================================""")
raise distutils.errors.DistutilsPlatformError(msg)
+ # After MSVC is initialized, add an explicit /MANIFEST to linker
+ # flags. See issues gh-4245 and gh-4101 for details. Also
+ # relevant are issues 4431 and 16296 on the Python bug tracker.
+ from distutils import msvc9compiler
+ if msvc9compiler.get_build_version() >= 10:
+ for ldflags in [self.compiler.ldflags_shared,
+ self.compiler.ldflags_shared_debug]:
+ if '/MANIFEST' not in ldflags:
+ ldflags.append('/MANIFEST')
+
if not isinstance(self.fcompiler, FCompiler):
self.fcompiler = new_fcompiler(compiler=self.fcompiler,
dry_run=self.dry_run, force=1,