|
5 | 5 |
|
6 | 6 | import os, signal |
7 | 7 | import warnings |
| 8 | +import sys |
8 | 9 |
|
9 | 10 | from distutils.command.config import config as old_config |
10 | 11 | from distutils.command.config import LANG_EXT |
11 | 12 | from distutils import log |
12 | 13 | from distutils.file_util import copy_file |
| 14 | +import distutils |
13 | 15 | from numpy.distutils.exec_command import exec_command |
14 | 16 | from numpy.distutils.mingw32ccompiler import generate_manifest |
15 | 17 |
|
@@ -49,6 +51,25 @@ def _check_compiler (self): |
49 | 51 | self.fcompiler.customize_cmd(self) |
50 | 52 | self.fcompiler.show_customization() |
51 | 53 |
|
| 54 | + if sys.platform == 'win32' and self.compiler.compiler_type == 'msvc': |
| 55 | + # XXX: hack to circumvent a python 2.6 bug with msvc9compiler: |
| 56 | + # initialize call query_vcvarsall, which throws an IOError, and |
| 57 | + # causes an error along the way without much information. We try to |
| 58 | + # catch it here, hoping it is early enough, and print an helpful |
| 59 | + # message instead of Error: None. |
| 60 | + if not self.compiler.initialized: |
| 61 | + try: |
| 62 | + self.compiler.initialize() |
| 63 | + except IOError, e: |
| 64 | + msg = """\ |
| 65 | +Could not initialize %s instance: do you have Visual Studio installed ? If you |
| 66 | +are trying to build with mingw, please use python setup.py build -c mingw32 |
| 67 | +instead (original caught exception was %s). If you have Visual Studio |
| 68 | +installed, check it is correctly installed, and the right version (VS 2008 for |
| 69 | +python 2.6, VS 2003 for 2.5, etc...)""" % \ |
| 70 | + (self.compiler.__class__.__name__, e) |
| 71 | + raise distutils.errors.DistutilsPlatformError(msg) |
| 72 | + |
52 | 73 | def _wrap_method(self,mth,lang,args): |
53 | 74 | from distutils.ccompiler import CompileError |
54 | 75 | from distutils.errors import DistutilsExecError |
|
0 commit comments