#NEWLINE# def detect_fortran_compiler( self , want_cross ) : #NEWLINE# #INDENT# evar = 'FC' #NEWLINE# if ( self . is_cross_build ( ) and want_cross ) : #NEWLINE# #INDENT# compilers = [ self . cross_info [ 'fortran' ] ] #NEWLINE# is_cross = True #NEWLINE# exe_wrap = self . cross_info . get ( 'exe_wrapper' , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( evar in os . environ ) : #NEWLINE# #INDENT# compilers = os . environ [ evar ] . split ( ) #NEWLINE# is_cross = False #NEWLINE# exe_wrap = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# compilers = self . default_fortran #NEWLINE# is_cross = False #NEWLINE# exe_wrap = None #NEWLINE# #UNINDENT# #UNINDENT# popen_exceptions = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for compiler in compilers : #NEWLINE# #INDENT# for arg in [ '--version' , '-V' ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# p = subprocess . Popen ( [ compiler , arg ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) #NEWLINE# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# popen_exceptions [ ' ' . join ( [ compiler , arg ] ) ] = e #NEWLINE# continue #NEWLINE# #UNINDENT# ( out , err ) = p . communicate ( ) #NEWLINE# out = out . decode ( errors = 'ignore' ) #NEWLINE# err = err . decode ( errors = 'ignore' ) #NEWLINE# version = 'unknown version' #NEWLINE# vmatch = re . search ( Environment . version_regex , out ) #NEWLINE# if vmatch : #NEWLINE# #INDENT# version = vmatch . group ( 0 ) #NEWLINE# #UNINDENT# if ( 'GNU Fortran' in out ) : #NEWLINE# #INDENT# return GnuFortranCompiler ( [ compiler ] , version , GCC_STANDARD , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# if ( 'G95' in out ) : #NEWLINE# #INDENT# return G95FortranCompiler ( [ compiler ] , version , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# if ( 'Sun Fortran' in err ) : #NEWLINE# #INDENT# version = 'unknown version' #NEWLINE# vmatch = re . search ( Environment . version_regex , err ) #NEWLINE# if vmatch : #NEWLINE# #INDENT# version = vmatch . group ( 0 ) #NEWLINE# #UNINDENT# return SunFortranCompiler ( [ compiler ] , version , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# if ( 'ifort (IFORT)' in out ) : #NEWLINE# #INDENT# return IntelFortranCompiler ( [ compiler ] , version , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# if ( 'PathScale EKOPath(tm)' in err ) : #NEWLINE# #INDENT# return PathScaleFortranCompiler ( [ compiler ] , version , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# if ( 'pgf90' in out ) : #NEWLINE# #INDENT# return PGIFortranCompiler ( [ compiler ] , version , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# if ( 'Open64 Compiler Suite' in err ) : #NEWLINE# #INDENT# return Open64FortranCompiler ( [ compiler ] , version , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# if ( 'NAG Fortran' in err ) : #NEWLINE# #INDENT# return NAGFortranCompiler ( [ compiler ] , version , is_cross , exe_wrap ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# errmsg = ( ( 'Unknown compiler(s): "' + ', ' . join ( compilers ) ) + '"' ) #NEWLINE# if popen_exceptions : #NEWLINE# #INDENT# errmsg += '\nThe follow exceptions were encountered:' #NEWLINE# for ( c , e ) in popen_exceptions . items ( ) : #NEWLINE# #INDENT# errmsg += '\nRunning "{0}" gave "{1}"' . format ( c , e ) #NEWLINE# #UNINDENT# #UNINDENT# raise EnvironmentException ( errmsg )