diff options
-rw-r--r-- | numpy/distutils/ccompiler.py | 5 | ||||
-rw-r--r-- | numpy/distutils/fcompiler/gnu.py | 6 | ||||
-rw-r--r-- | numpy/distutils/misc_util.py | 12 | ||||
-rw-r--r-- | numpy/testing/numpytest.py | 2 |
4 files changed, 20 insertions, 5 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index f865416b3..efd458897 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -10,7 +10,7 @@ from distutils.version import LooseVersion import log from exec_command import exec_command -from misc_util import cyg2win32, is_sequence +from misc_util import cyg2win32, is_sequence, mingw32 from distutils.spawn import _nt_quote_args # Using customized CCompiler.spawn. @@ -235,8 +235,7 @@ if sys.platform == 'win32': compiler_class['mingw32'] = ('mingw32ccompiler', 'Mingw32CCompiler', "Mingw32 port of GNU C Compiler for Win32"\ "(for MSC built Python)") - if os.environ.get('OSTYPE','')=='msys' or \ - os.environ.get('MSYSTEM','')=='MINGW32': + if mingw32(): # On windows platforms, we want to default to mingw32 (gcc) # because msvc can't build blitz stuff. log.info('Setting mingw32 as default compiler for nt.') diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index ef0426b5e..10bafdf8e 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -7,6 +7,7 @@ import warnings from numpy.distutils.cpuinfo import cpu from numpy.distutils.fcompiler import FCompiler from numpy.distutils.exec_command import exec_command, find_executable +from numpy.distutils.misc_util import mingw32 class GnuFCompiler(FCompiler): @@ -104,7 +105,10 @@ class GnuFCompiler(FCompiler): g2c = self.g2c if sys.platform=='win32': - opt.append('gcc') + # To avoid undefined reference __EH_FRAME_BEGIN__ linker error, + # don't use -lgcc option for mingw32 g77 linker. + if not mingw32(): + opt.append('gcc') if g2c is not None: opt.append(g2c) if sys.platform == 'darwin': diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py index 7fe329385..0de24cc94 100644 --- a/numpy/distutils/misc_util.py +++ b/numpy/distutils/misc_util.py @@ -9,7 +9,7 @@ __all__ = ['Configuration', 'get_numpy_include_dirs', 'default_config_dict', 'dict_append', 'appendpath', 'generate_config_py', 'get_cmd', 'allpath', 'get_mathlibs', 'terminal_has_colors', 'red_text', 'green_text', 'yellow_text', - 'blue_text', 'cyan_text', 'cyg2win32', 'all_strings', + 'blue_text', 'cyan_text', 'cyg2win32','mingw32','all_strings', 'has_f_sources', 'has_cxx_sources', 'filter_sources', 'get_dependencies', 'is_local_src_dir', 'get_ext_source_files', 'get_script_files', 'get_lib_source_files', 'get_data_files', @@ -158,6 +158,16 @@ def cyg2win32(path): path = path[10] + ':' + os.path.normcase(path[11:]) return path +def mingw32(): + """ Return true when using mingw32 environment. + """ + if sys.platform=='win32': + if os.environ.get('OSTYPE','')=='msys': + return True + if os.environ.get('MSYSTEM','')=='MINGW32': + return True + return False + ######################### #XXX need support for .C that is also C++ diff --git a/numpy/testing/numpytest.py b/numpy/testing/numpytest.py index 9ddfbdd8c..5fa244726 100644 --- a/numpy/testing/numpytest.py +++ b/numpy/testing/numpytest.py @@ -370,6 +370,8 @@ class NumpyTest: if package_name != name[:len(package_name)] \ or module is None: continue + if not hasattr(module,'__file__'): + continue if os.path.basename(os.path.dirname(module.__file__))=='tests': continue modules.append(module) |