diff options
author | David Cournapeau <cournape@gmail.com> | 2008-12-27 10:15:30 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-12-27 10:15:30 +0000 |
commit | 6bbab81d5d11dd1eb38f40c8a3dfc699885701d3 (patch) | |
tree | f76f16d5d4097c3579b197559e8e61880c43e2c6 /numpy/distutils/command/config.py | |
parent | 6cadd13e1ae92123187e5f59d84bbeb2bcbd4776 (diff) | |
download | numpy-6bbab81d5d11dd1eb38f40c8a3dfc699885701d3.tar.gz |
BUG (#970): fix a python 2.6 bug in distutils which caused an unhelpful Error:None message when trying to build with no VS installed and without the -c mingw32 option.
Diffstat (limited to 'numpy/distutils/command/config.py')
-rw-r--r-- | numpy/distutils/command/config.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index d24d60598..d0582b8cd 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -5,11 +5,13 @@ import os, signal import warnings +import sys from distutils.command.config import config as old_config from distutils.command.config import LANG_EXT from distutils import log from distutils.file_util import copy_file +import distutils from numpy.distutils.exec_command import exec_command from numpy.distutils.mingw32ccompiler import generate_manifest @@ -49,6 +51,25 @@ class config(old_config): self.fcompiler.customize_cmd(self) self.fcompiler.show_customization() + if sys.platform == 'win32' and self.compiler.compiler_type == 'msvc': + # XXX: hack to circumvent a python 2.6 bug with msvc9compiler: + # initialize call query_vcvarsall, which throws an IOError, and + # causes an error along the way without much information. We try to + # catch it here, hoping it is early enough, and print an helpful + # message instead of Error: None. + if not self.compiler.initialized: + try: + self.compiler.initialize() + except IOError, e: + msg = """\ +Could not initialize %s instance: do you have Visual Studio installed ? If you +are trying to build with mingw, please use python setup.py build -c mingw32 +instead (original caught exception was %s). 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...)""" % \ + (self.compiler.__class__.__name__, e) + raise distutils.errors.DistutilsPlatformError(msg) + def _wrap_method(self,mth,lang,args): from distutils.ccompiler import CompileError from distutils.errors import DistutilsExecError |