<s> import re <EOL> import sys <EOL> from waflib import Options <EOL> import os . path as osp <EOL> from waflib import Logs <EOL> from waflib import Context <EOL> from waflib import Errors <EOL> def options ( ctx ) : <EOL> import optparse <EOL> grp = ctx . parser . get_option_group ( "<STR_LIT>" ) <EOL> if grp == None : <EOL> grp = optparse . OptionGroup ( ctx . parser , "<STR_LIT>" ) <EOL> grp . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , default = False , help = "<STR_LIT>" ) <EOL> grp . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , default = False , help = "<STR_LIT>" ) <EOL> grp . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , default = "<STR_LIT>" , help = "<STR_LIT>" ) <EOL> ctx . add_option_group ( grp ) <EOL> def configure_ ( ctx ) : <EOL> if ctx . options . fortran_flagline : <EOL> conf . parse_flags ( ctx . options . fortran_flagline , uselib = "<STR_LIT>" ) <EOL> if sys . platform . lower ( ) == "<STR_LIT>" : <EOL> ctx . env . fcshlib_PATTERN = '<STR_LIT>' <EOL> ctx . env . has_ifort = False <EOL> if not Options . options . gfortran : <EOL> try : <EOL> ifort_conf ( ctx ) <EOL> return <EOL> except Exception , e : <EOL> if Options . options . ifort : <EOL> raise <EOL> Logs . pprint ( "<STR_LIT>" , "<STR_LIT>" % e ) <EOL> gfortran_conf ( ctx ) <EOL> def configure ( ctx ) : <EOL> configure_ ( ctx ) <EOL> ctx . env . append_value ( "<STR_LIT>" , ctx . env . LINKFLAGS_fcshlib ) <EOL> ctx . env [ "<STR_LIT>" ] = [ ] <EOL> ctx . env . append_value ( "<STR_LIT>" , [ flg for flg in ctx . env . FCFLAGS_fcshlib if "<STR_LIT>" in flg . lower ( ) ] ) <EOL> def show_linkline ( ctx ) : <EOL> ctx . start_msg ( "<STR_LIT>" ) <EOL> ctx . end_msg ( "<STR_LIT:U+0020>" . join ( [ "<STR_LIT>" % vv for vv in ctx . env . LIBPATH_fc_runtime ] ) + "<STR_LIT:U+0020>" + "<STR_LIT:U+0020>" . join ( [ "<STR_LIT>" % vv for vv in ctx . env . LIB_fc_runtime ] ) ) <EOL> def ifort_conf ( ctx ) : <EOL> import waflib <EOL> import os <EOL> ctx . env . FC = [ ] <EOL> ctx . load ( '<STR_LIT>' ) <EOL> if sys . platform . lower ( ) == "<STR_LIT>" : <EOL> ctx . env . LINKFLAGS_fcshlib = [ '<STR_LIT>' ] <EOL> ctx . env . append_value ( '<STR_LIT>' , ctx . env . mopt . split ( ) ) <EOL> ctx . env [ "<STR_LIT>" ] = [ ] <EOL> ctx . env . append_value ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ctx . env . FCSHLIB_MARKER = [ "<STR_LIT>" ] <EOL> ctx . env . FCSTLIB_MARKER = [ "<STR_LIT>" ] <EOL> ctx . check_cc ( <EOL> errmsg = "<STR_LIT>" , msg = '<STR_LIT>' , <EOL> mandatory = <NUM_LIT:1> , fragment = "<STR_LIT>" , compile_filename = '<STR_LIT>' , features = '<STR_LIT>' ) <EOL> if not ctx . options . fortran_flagline : <EOL> ctx . start_msg ( "<STR_LIT>" ) <EOL> try : <EOL> llgo , llge = ctx . cmd_and_log ( "<STR_LIT>" % ( ctx . env . FC , "<STR_LIT:U+0020>" . join ( ctx . env . FCFLAGS + ctx . env . FCFLAGS_fc_omp ) ) , output = waflib . Context . BOTH ) <EOL> L = set ( [ ll . strip ( ) for ll in re . findall ( "<STR_LIT>" , llge . split ( "<STR_LIT>" ) [ <NUM_LIT:1> ] ) if ( "<STR_LIT>" in ll . lower ( ) ) or ( "<STR_LIT>" in ll . lower ( ) ) ] ) <EOL> l = set ( [ ll . strip ( ) for ll in re . findall ( "<STR_LIT>" , llge . split ( "<STR_LIT>" ) [ <NUM_LIT:1> ] ) ] ) <EOL> rL = set ( ) <EOL> rl = set ( ) <EOL> for Li in L : <EOL> oli = os . listdir ( Li ) <EOL> for li in l : <EOL> if ctx . env . cshlib_PATTERN % li in oli : <EOL> rl . add ( li ) <EOL> rL . add ( Li ) <EOL> except : <EOL> ctx . end_msg ( False ) <EOL> raise <EOL> for pth in list ( rL ) + [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> if osp . exists ( pth ) : <EOL> ctx . env . append_value ( "<STR_LIT>" , pth ) <EOL> ctx . env . append_value ( "<STR_LIT>" , pth ) <EOL> ctx . env . append_value ( "<STR_LIT>" , list ( rl ) + [ "<STR_LIT>" ] ) <EOL> ctx . end_msg ( True ) <EOL> show_linkline ( ctx ) <EOL> ctx . env . has_ifort = True <EOL> def ifort_conf_ ( ctx ) : <EOL> ctx . env . FC = [ ] <EOL> ctx . load ( '<STR_LIT>' ) <EOL> if sys . platform . lower ( ) == "<STR_LIT>" : <EOL> ctx . env . LINKFLAGS_fcshlib = [ '<STR_LIT>' ] <EOL> ctx . env . append_value ( '<STR_LIT>' , ctx . env . mopt . split ( ) ) <EOL> ctx . env . append_value ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ctx . env . FCSHLIB_MARKER = [ "<STR_LIT>" ] <EOL> ctx . env . FCSTLIB_MARKER = [ "<STR_LIT>" ] <EOL> ctx . check_cc ( <EOL> errmsg = "<STR_LIT>" , msg = '<STR_LIT>' , <EOL> mandatory = <NUM_LIT:1> , fragment = "<STR_LIT>" , compile_filename = '<STR_LIT>' , features = '<STR_LIT>' ) <EOL> if not ctx . options . fortran_flagline : <EOL> ctx . start_msg ( "<STR_LIT>" ) <EOL> if "<STR_LIT:/>" not in ctx . env . FC : <EOL> ctx . env . FC = ctx . cmd_and_log ( "<STR_LIT>" % ctx . env . FC ) . strip ( ) <EOL> ifort_path = osp . dirname ( osp . realpath ( ctx . env . FC ) ) <EOL> if ctx . options . m32 : <EOL> try : <EOL> f = open ( osp . join ( ifort_path , '<STR_LIT>' ) ) <EOL> except : <EOL> ctx . end_msg ( False ) <EOL> raise Errors . WafError ( "<STR_LIT>" ) <EOL> else : <EOL> try : <EOL> f = open ( osp . join ( ifort_path , '<STR_LIT>' ) ) <EOL> except : <EOL> ctx . end_msg ( False ) <EOL> raise Errors . WafError ( "<STR_LIT>" ) <EOL> txt = f . read ( ) <EOL> f . close ( ) <EOL> if sys . platform . lower ( ) == "<STR_LIT>" : <EOL> sp = "<STR_LIT>" <EOL> else : <EOL> sp = "<STR_LIT>" <EOL> res = re . findall ( "<STR_LIT>" + sp + "<STR_LIT>" , txt ) [ <NUM_LIT:0> ] <EOL> for pth in res . split ( "<STR_LIT::>" ) : <EOL> ctx . env . append_value ( "<STR_LIT>" , pth ) <EOL> ctx . env . append_value ( "<STR_LIT>" , pth ) <EOL> ctx . env . append_value ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> ctx . end_msg ( True ) <EOL> show_linkline ( ctx ) <EOL> def gfortran_conf ( ctx ) : <EOL> ctx . env . FC = [ ] <EOL> ctx . env . FCFLAGS = [ ] <EOL> ctx . load ( '<STR_LIT>' ) <EOL> ctx . env [ "<STR_LIT>" ] = [ ] <EOL> ctx . env . append_value ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ctx . env . append_value ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ctx . env . append_value ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> ctx . env . append_value ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> mopt = ctx . env . mopt <EOL> if sys . platform . lower ( ) == "<STR_LIT>" : <EOL> if "<STR_LIT>" in ctx . env . mopt : <EOL> ctx . env . append_value ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> mopt = "<STR_LIT>" <EOL> else : <EOL> ctx . env . append_value ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> mopt = "<STR_LIT>" <EOL> else : <EOL> ctx . env . append_value ( '<STR_LIT>' , ctx . env . mopt . split ( ) ) <EOL> ctx . start_msg ( "<STR_LIT>" ) <EOL> v90 = ctx . cmd_and_log ( ctx . env . FC + "<STR_LIT>" , quiet = Context . STDOUT ) . split ( "<STR_LIT:\n>" ) [ <NUM_LIT:0> ] . strip ( ) <EOL> version90 = re . findall ( "<STR_LIT>" , v90 ) <EOL> if len ( version90 ) < <NUM_LIT:1> : <EOL> ctx . end_msg ( "<STR_LIT>" , color = "<STR_LIT>" ) <EOL> else : <EOL> version90 = version90 [ <NUM_LIT:0> ] <EOL> vmid = int ( version90 . split ( "<STR_LIT:.>" ) [ <NUM_LIT:1> ] ) <EOL> if vmid < <NUM_LIT:3> : <EOL> ctx . end_msg ( v90 , color = "<STR_LIT>" ) <EOL> raise Errors . WafError ( "<STR_LIT>" % version90 ) <EOL> ctx . end_msg ( v90 ) <EOL> ctx . env . FCSHLIB_MARKER = [ "<STR_LIT>" ] <EOL> ctx . env . FCSTLIB_MARKER = [ mopt ] <EOL> ctx . check_cc ( <EOL> errmsg = "<STR_LIT>" , msg = '<STR_LIT>' , <EOL> mandatory = <NUM_LIT:1> , fragment = "<STR_LIT>" , compile_filename = '<STR_LIT>' , features = '<STR_LIT>' ) <EOL> ctx . start_msg ( "<STR_LIT>" ) <EOL> lgfpath = ctx . cmd_and_log ( ctx . env . FC + "<STR_LIT>" % mopt , quiet = Context . STDOUT ) <EOL> lpath = [ osp . dirname ( osp . realpath ( lgfpath ) ) ] <EOL> lgfpath = ctx . cmd_and_log ( ctx . env . FC + "<STR_LIT>" % mopt , quiet = Context . STDOUT ) <EOL> lpath += [ osp . dirname ( osp . realpath ( lgfpath ) ) ] <EOL> lpath = set ( lpath ) <EOL> ctx . env . append_value ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> ctx . env . append_value ( "<STR_LIT>" , list ( lpath ) ) <EOL> ctx . env . append_value ( "<STR_LIT>" , list ( lpath ) ) <EOL> ctx . end_msg ( True ) <EOL> show_linkline ( ctx ) </s>
