1616from numpy .distutils .exec_command import exec_command
1717from numpy .distutils .mingw32ccompiler import generate_manifest
1818from numpy .distutils .command .autodist import check_inline , check_compiler_gcc4
19+ from numpy .distutils .compat import get_exception
1920
2021LANG_EXT ['f77' ] = '.f'
2122LANG_EXT ['f90' ] = '.f90'
@@ -53,7 +54,8 @@ def _check_compiler (self):
5354 if not self .compiler .initialized :
5455 try :
5556 self .compiler .initialize ()
56- except IOError , e :
57+ except IOError :
58+ e = get_exception ()
5759 msg = """\
5860 Could not initialize compiler instance: do you have Visual Studio
5961installed ? If you are trying to build with mingw, please use python setup.py
@@ -63,8 +65,8 @@ def _check_compiler (self):
6365class was %s
6466============================================================================""" \
6567 % (e , self .compiler .__class__ .__name__ )
66- print """\
67- ============================================================================"""
68+ print ( """\
69+ ============================================================================""")
6870 raise distutils .errors .DistutilsPlatformError (msg )
6971
7072 if not isinstance (self .fcompiler , FCompiler ):
@@ -85,7 +87,8 @@ def _wrap_method(self,mth,lang,args):
8587 self .compiler = self .fcompiler
8688 try :
8789 ret = mth (* ((self ,)+ args ))
88- except (DistutilsExecError ,CompileError ),msg :
90+ except (DistutilsExecError ,CompileError ):
91+ msg = str (get_exception ())
8992 self .compiler = save_compiler
9093 raise CompileError
9194 self .compiler = save_compiler
@@ -188,7 +191,7 @@ def check_type(self, type_name, headers=None, include_dirs=None,
188191 self ._compile (body % {'type' : type_name },
189192 headers , include_dirs , 'c' )
190193 st = True
191- except distutils .errors .CompileError , e :
194+ except distutils .errors .CompileError :
192195 st = False
193196 finally :
194197 self ._clean ()
0 commit comments