From 3f82799ae312c903bb6136684214533b5e4673af Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Fri, 26 Dec 2008 12:16:45 +0000 Subject: Update to handle numscons 0.10.0 and above. --- numpy/distutils/command/scons.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'numpy/distutils/command') diff --git a/numpy/distutils/command/scons.py b/numpy/distutils/command/scons.py index d5303bb29..5f4c42ba4 100644 --- a/numpy/distutils/command/scons.py +++ b/numpy/distutils/command/scons.py @@ -361,9 +361,13 @@ class scons(old_build_ext): try: minver = "0.9.3" - from numscons import get_version - if get_version() < minver: - raise ValueError() + try: + # version_info was added in 0.10.0 + from numscons import version_info + except ImportError: + from numscons import get_version + if get_version() < minver: + raise ValueError() except ImportError: raise RuntimeError("You need numscons >= %s to build numpy "\ "with numscons (imported numscons path " \ -- cgit v1.2.1 From 6bbab81d5d11dd1eb38f40c8a3dfc699885701d3 Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Sat, 27 Dec 2008 10:15:30 +0000 Subject: 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. --- numpy/distutils/command/config.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'numpy/distutils/command') 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 -- cgit v1.2.1 From 7b811f816d7f95d4207117ff4a72e206b732270c Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Sat, 27 Dec 2008 10:30:49 +0000 Subject: Improve the error message when initializing compiler failed. --- numpy/distutils/command/config.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'numpy/distutils/command') diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index d0582b8cd..aa9a67e87 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -62,12 +62,16 @@ class config(old_config): 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) +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 +============================================================================""" \ + % (e, self.compiler.__class__.__name__) + print """\ +============================================================================""" raise distutils.errors.DistutilsPlatformError(msg) def _wrap_method(self,mth,lang,args): -- cgit v1.2.1 From cdc45ed90d1eecc9a025448a0dce2644b75de66f Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Sat, 27 Dec 2008 10:32:05 +0000 Subject: Try to initialize the msvc compiler before the general code to detect the error early. --- numpy/distutils/command/config.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'numpy/distutils/command') diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index aa9a67e87..1526dd411 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -41,15 +41,6 @@ class config(old_config): def _check_compiler (self): old_config._check_compiler(self) from numpy.distutils.fcompiler import FCompiler, new_fcompiler - if not isinstance(self.fcompiler, FCompiler): - self.fcompiler = new_fcompiler(compiler=self.fcompiler, - dry_run=self.dry_run, force=1, - c_compiler=self.compiler) - if self.fcompiler is not None: - self.fcompiler.customize(self.distribution) - if self.fcompiler.get_version(): - 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: @@ -74,6 +65,16 @@ class was %s ============================================================================""" raise distutils.errors.DistutilsPlatformError(msg) + if not isinstance(self.fcompiler, FCompiler): + self.fcompiler = new_fcompiler(compiler=self.fcompiler, + dry_run=self.dry_run, force=1, + c_compiler=self.compiler) + if self.fcompiler is not None: + self.fcompiler.customize(self.distribution) + if self.fcompiler.get_version(): + self.fcompiler.customize_cmd(self) + self.fcompiler.show_customization() + def _wrap_method(self,mth,lang,args): from distutils.ccompiler import CompileError from distutils.errors import DistutilsExecError -- cgit v1.2.1 From 8c448a31743b9ea5bc18e06dfa42c078206ca529 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 31 Dec 2008 23:25:03 +0000 Subject: ran reindent --- numpy/distutils/command/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/distutils/command') diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index 1526dd411..408b9f0b4 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -53,11 +53,11 @@ class config(old_config): self.compiler.initialize() except IOError, e: msg = """\ -Could not initialize compiler instance: do you have Visual Studio +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 +2.5, etc...). Original exception was: %s, and the Compiler class was %s ============================================================================""" \ % (e, self.compiler.__class__.__name__) -- cgit v1.2.1