[Numpy-svn] r6200 - trunk/numpy/distutils/command

numpy-svn@scip... numpy-svn@scip...
Sat Dec 27 04:15:34 CST 2008


Author: cdavid
Date: 2008-12-27 04:15:30 -0600 (Sat, 27 Dec 2008)
New Revision: 6200

Modified:
   trunk/numpy/distutils/command/config.py
Log:
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.

Modified: trunk/numpy/distutils/command/config.py
===================================================================
--- trunk/numpy/distutils/command/config.py	2008-12-27 10:06:25 UTC (rev 6199)
+++ trunk/numpy/distutils/command/config.py	2008-12-27 10:15:30 UTC (rev 6200)
@@ -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 @@
                     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



More information about the Numpy-svn mailing list