Kc@sdZddddgZddkZddkZddkZddkZyeWn#ej oddkl ZnXddk l Z l Z dd k lZdd klZlZlZlZlZdd klZlZdd klZlZdd klZddklZlZl Z l!Z!ddk"l#Z#ddk$l%Z%e&Z'de(fdYZ)dZ*dZ+dZ,defdYZ-ddddddddffddddddddffd dd!d"d#dd$d%d&d'd(ddf fd)d$dd*d!dddffd+d,dddffd-d.ddffd/d*ddffd0ddffd1ddffd2ddfff Z.e/a0e/a1d3Z2e/e/e3e/d4Z4e/e/d5Z5e/e/e3e/d6Z6e/e/d7d7d7e3e/d8Z7e/d9Z8d:Z9ei:d;ei;i<Z=ei:d<ei;i>Z?ei:d=ei;i>Z@ei:d>ei;i>ZAei:d?ei;i<ZBd@ZCdAZDei:dBei;ZEdCZFeGdDjo e8ndS(Esnumpy.distutils.fcompiler Contains FCompiler, an abstract base class that defines the interface for the numpy.distutils Fortran compiler abstraction model. Terminology: To be consistent, where the term 'executable' is used, it means the single file, like 'gcc', that is executed, and should be a string. In contrast, 'command' means the entire command line, like ['gcc', '-c', 'file.c'], and should be a list. But note that FCompiler.executables is actually a dictionary of commands. t FCompilert new_fcompilertshow_fcompilerstdummy_fortran_fileiN(tSet(tget_config_vartget_python_lib(t FancyGetopt(tDistutilsModuleErrortDistutilsExecErrort CompileErrort LinkErrortDistutilsPlatformError(t split_quotedt strtobool(t CCompilertgen_lib_options(tlog(t is_stringt all_stringst is_sequencetmake_temp_file(tEnvironmentConfig(tfind_executabletCompilerNotFoundcBseZRS((t__name__t __module__(((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyR*scCs t|o t|S|SdS(N(RR (ts((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytflaglist-s  cCs"t|o t|St|S(N(RRtbool(R((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytstr2bool3s  cCst|o t|S(N(RR(tseq((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytis_sequence_of_strings8sc(Bs eZdZeddddddefddddefddddefddddefZeddddd ddddddddddddd Zeddd d!d"d#efd$d%d&d'efd(d)d*d+efd,d-ddefd.d/d0d.efd1d2ddefd3d4ddefd5d6d7d5efd8d9ddefd:d;ddefdd<d=d>efd?d@ddefdAdBddefdCdDdEdFefddGdHdIefddJdHdIefddKdLdMefZ hd dN6d dO6d dP6d dQ6d dR6d$dS6d$dT6d$dU6Z d$d gZ dZ dZ dZgZhd dVgd6d gd6d$gd 6d$dWgd6d$dXgd6d$gd6ddYgd6dd6ZdZdZZd[Zd[ZdZd\ZgZdOdQdRdNdSdUdPdTgZd]Zed^Zd_Zd`ZdaZdbZhZ ddd dddddgZ!dZ"dcZ#ddZ$deZ%dfZ&e&dZ'e&dZ(e&d Z)e&dZ*e&dZ+e&dZ,e&dZ-e&dZ.dgZ/dhZ0diZ1djZ2dkZ3dlZ4dmZ5dnZ6doZ7dpZ8dqZ9drZ:dsZ;dtZ<duZ=dvZ>dwZ?e=Z@ZAe>ZBZCe?ZDZEdxZFdyZGeHdzgd{ZIdd|ZJd}ZKd~ZLdZMdZNdZOddddddzddddd ZPdZQRS(s0Abstract base class to define the interface that must be implemented by real Fortran compiler classes. Methods that subclasses may redefine: update_executables(), find_executables(), get_version() get_flags(), get_flags_opt(), get_flags_arch(), get_flags_debug() get_flags_f77(), get_flags_opt_f77(), get_flags_arch_f77(), get_flags_debug_f77(), get_flags_f90(), get_flags_opt_f90(), get_flags_arch_f90(), get_flags_debug_f90(), get_flags_fix(), get_flags_linker_so() DON'T call these methods (except get_version) after constructing a compiler instance or inside any other method. All methods, except update_executables() and find_executables(), may call the get_version() method. After constructing a compiler instance, always call customize(dist=None) method that finalizes compiler construction and makes the following attributes available: compiler_f77 compiler_f90 compiler_fix linker_so archiver ranlib libraries library_dirs tdistutils_sectiont config_fctnoopttnoarchtdebugtverboset compiler_f77sexe.compiler_f77tF77tf77exect compiler_f90sexe.compiler_f90tF90tf90exect compiler_fixsexe.compiler_fixt version_cmdsexe.version_cmdt linker_sos exe.linker_sotLDSHAREDtldsharedt linker_exesexe.linker_exetLDtldtarchivertARtartranlibtRANLIBtf77s flags.f77tF77FLAGStf77flagstf90s flags.f90tF90FLAGStf90flagstfrees flags.freet FREEFLAGSt freeflagstfixs flags.fixtopts flags.opttFOPTtopt_f77s flags.opt_f77topt_f90s flags.opt_f90tarchs flags.archtFARCHtarch_f77sflags.arch_f77tarch_f90sflags.arch_f90s flags.debugtFDEBUGtfdebugt debug_f77sflags.debug_f77t debug_f90sflags.debug_f90tflagssself.get_flagstFFLAGStfflagssflags.linker_sotLDFLAGStldflagssflags.linker_exesflags.artARFLAGStarflagss.fs.fors.Fs.ftns.f77s.f90s.F90s.f95s-vs-fixeds-shareds-crs-cs-o s-Is.otSOs.aslib%s%ss%s%stcOsti||||ii|i|_|ii|i|_|ii|i|_|ii|_x2|i D]'}||ijod|i|" or "", the Fortran 77 or the Fortran 90 compiler executable is used, unless overridden by an environment setting. Subclasses should call this if overriden. cs8|jo |St|}||<|<|S(N(R(texetfc_exe(t exe_cache(sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytcached_find_executable$s    csB|dj o1t| o#td||iifndS(Ns"%s value %r is invalid in class %s(RbR R{RkR(tnameRu(Re(sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytverify_command_form*sc s,ii|d}|pdSti|}|p||gi}n|gi}t}g}xr|D]j}|djo |}n|djo |}n| p ||joqwn|i||i|qwWx0|D](} | } | o| |d<| SqWi |ddS(Nssi( R_tgetRbtgetattrR]tpossible_executablestsettaddtappendRt( texe_keyR:R=tcmdtexe_from_environt possiblestseentunique_possiblesRhR|R}(RRe(sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytset_exe/s6         R*R's %s: no Fortran 90 compiler founds%s: f90 nor f77R=s %s: no Fortran 77 compiler foundR-R/R:R2R.R5R8N(RdRot _exe_cacheRbt compiler_typeRtwarnR(ReRRtctypeR=R:((RReR~sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytfind_executabless*     cCsdS(sqCalled at the beginning of customisation. Subclasses should override this if they need to set up the executables dictionary. Note that self.find_executables() is run afterwards, so the self.executables dictionary values can contain or as the command, which will be replaced by the found F77 or F90 compiler. N((telf((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytupdate_executablescs cCs g|iS(s+List of flags common to all compiler types.(t pic_flags(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt get_flagsnscCs/|ii|d}|djogS|dS(Ni(R_RRb(ReRpR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt_get_command_flagsrs cCs |idS(s"List of Fortran 77 specific flags.R'(R(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt get_flags_f77xscCs |idS(s"List of Fortran 90 specific flags.R*(R(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt get_flags_f90{scCsgS(s.List of Fortran 90 free format specific flags.((Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytget_flags_free~scCs |idS(s/List of Fortran 90 fixed format specific flags.R-(R(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt get_flags_fixscCs |idS(s/List of linker flags to build a shared library.R/(R(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytget_flags_linker_soscCs |idS(s,List of linker flags to build an executable.R2(R(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytget_flags_linker_exescCs |idS(sList of archiver flags. R5(R(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt get_flags_arscCsgS(s0List of architecture independent compiler flags.((Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt get_flags_optscCsgS(s.List of architecture dependent compiler flags.((Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytget_flags_archscCsgS(s=List of compiler flags to compile with debugging information.((Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytget_flags_debugscCs|iS(sList of compiler libraries.(t libraries(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt get_librariesscCs|iS(s%List of compiler library directories.(t library_dirs(Re((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytget_library_dirssicCs*|iptti|d|d|S(Ntforcet ok_status(RdRoRt get_version(ReRR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyRscsytidiit_ii|ii|i i|i i ii dt }ii d|}ii dt }iiiiggg}goi inoi ii i}niioi inggg}}}fd} |p)| d||p| d|qn|o| d|ni i|||} oidg| no#id g|| noid g| ni} | oi i} tiid o[td d } tii| dd}tii| dd}|g| d|g} nid| | ni}|o$i i}id||nii }|o'i i!}id|g|ni"i#i$i%dS(sCustomize Fortran compiler. This method gets Fortran compiler specific information from (i) class definition, (ii) environment, (iii) distutils config files, and (iv) command line (later overrides earlier). This method should be always called after constructing a compiler instance. But not in __init__ because Distribution instance is needed for (iii) and (iv). s customize %sR#R$R%cs|iti|td|}xdfdfdfgD]]\}}}d||f}|o7|td|j o|iti|qWqWWdS(Nt get_flags_R:R=s%s_%s(textendRR^(ttagRPtthis_getRtctflagvartt(R<ReR=R?R:RCtfixflags(sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyRs !RDRHR'R*R-taixt standard_libitconfigt ld_so_aixs python.exps-bI:R/R2R5N(&RtinfoRkRtTrueRdRZtuse_distributionR]R^RRRRcR'R*R:R=R@R-RCRPRzR/tsystplatformt startswithRtostpathtjoinR2R5R7tset_library_dirsRt set_librariesR(RetdistR#R$R%RBtoflagstaflagstdflagsRRRR/tlinker_so_flagst python_libRt python_expR2tlinker_exe_flagsR7RV((RCReRR<R=R?R:sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt customizest        !  #      cCsg}xm|iidddddgD]I}t||o3t||}|i|d dt|fq)q)W|it|}xI|i d|i i D].}|d d jod |d}n|GHqWd S( s0Print out the attributes of a compiler instance.tversionRRt object_switchtcompile_switchs= s%s instance properties:is --s N( R_tkeysthasattrRRRbtreprtsortRt generate_helpRkR(RetpropsRpRytpretty_printertl((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytdump_propertiess   (   cCsh}t|o-t| od}|i} t|}nt|o=d}|i} | d jotd|ii |fqn:d}|i } | d jotd|ii |fn|i ddjo|i i |g} n|i i |g} |i i pt|i |g} |i|ig} | otiddi| n| || | | |} d tii| d ||f}y|i| d |Wntj o}t|nXd S( sCompile 'src' to product 'obj'.s:f77s:f90s%f90 not supported by %s needed for %ss:fixs-f90 (fixed) not supported by %s needed for %sit s%using compile options from source: %rs%s: %sitdisplayN(t is_f_filethas_f90_headerR't get_f77flagstis_free_formatR*RbR RkRR-RtstripRRoRRRRRRRtbasenametspawnR (ReRmtsrctexttcc_argstextra_postargstpp_optst src_flagstflavortcompilerto_argsts_argst extra_flagstcommandRtmsg((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyt_compile#s@        cCsg}|idj oR|iddjo |i|ii|gq|i|ii|nd|GHdG|iiGH|idj o6xK|g|D] }|id|i|fqWnd|GHdG|iiGH|S(NiRs'XXX: module_build_dir=%r option ignoredsXXX: Fix module_dir_switch for s%s%ss"XXX: module_dirs=%r option ignoreds#XXX: Fix module_include_switch for (tmodule_dir_switchRbRRRRkRtmodule_include_switch(Ret module_dirstmodule_build_dirtoptionstd((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytmodule_optionsMs  " cCsd|S(Ns-l((Retlib((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytlibrary_option_scCsd|S(Ns-L((Retdir((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytlibrary_dir_optionascCs|i||\}}|i|||\}}}t||||}t|otii||}n|dj o tdn|i ||oH|i ddjo|i i |g}n|i i |g}t|i o||i g}n||i }|||}| odg|d*n| o| |d*n| o|i | n|itii||tijo|i}n |i}||}y|i|Wqtj o}t|qXntid|dS(Ns%'output_dir' must be a string or NoneiRs-gisskipping %s (up-to-date)(t_fix_object_argst _fix_lib_argsRRRRRRbt TypeErrort _need_linktlibrary_switchRtobjectsRtmkpathtdirnameRt EXECUTABLER2R/RR R RR%(Ret target_descRtoutput_filenamet output_dirRRtruntime_library_dirstexport_symbolsR%t extra_preargsRt build_tempt target_langtlib_optsRtld_argstlinkerRR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pytlinkds@        cCs|djodSt|o|ido!|d}t||}|S|ido/|d}|i|}|o |dSdSq|ido%|d}t|d|}|Sn|SdS( Nsself.isexe.iisflags.iR(RbRRRR_(ReRt hook_namethooktvar((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyR\s$        N(sexe.compiler_f77R(R)N(sexe.compiler_f90R+R,N(sexe.compiler_fixR+R,N(sexe.version_cmdNNN(s exe.linker_soR0R1N(sexe.linker_exeR3R4N(NR6sarN(NR9R8N((RRRt__doc__RRbRRZR]RR^t language_maptlanguage_orderRtcompiler_aliasestversion_patternRR_tsuggested_f90_compilerRRRRRRtsrc_extensionst obj_extensionRtshared_lib_extensiontstatic_lib_extensiontstatic_lib_formattshared_lib_formatt exe_extensionRRat c_compilerRYRnR`RsR.R'R*R-R/R2R5R8RvRzRtRRRRRRRRRRRRRRtget_flags_opt_f77tget_flags_opt_f90tget_flags_arch_f77tget_flags_arch_f90tget_flags_debug_f77tget_flags_debug_f90RRRcRRRRRRRR R\(((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyR;s                                 O                  e  *    *twin32tgnutintelvtabsofttcompaqvtintelevtgnu95tg95scygwin.*slinux.*tinteltlaheytpgtnagtvasttcompaqtinteletintelemsdarwin.*tibmssunos.*tsunsirix.*tmipssaix.*tposixtnttmacc Cs^ddkl}tdj odStiitiitd}hahax||D]}tii tii |\}}d|}t |t i |}t|dox|iD]}t||}|i||if}|t|iRRRRR( RNRR&R^RRRRRERHtlong_descriptionR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyRs(           cCs|djoddkl}ddkl}|}tiiti d|_ dgti d|_ y|i i dWnt j onX||id<|i|ing}g}g}tp tnt}x|D]}d}tidy5td |d |i} | i|| i}WnBttfj o0} tid |ftit| nX|djo&|id |dt|d fq| i|id |dt|d d|fqWt t!ti"t!|}g} |D]"} | d | dt| d fq~ }|i#|i#|i#t$|} | i%dt$|} | i%d|ot$|} | i%dndGHdS(sbPrint list of available compilers (used by the "--help-fcompiler" option to "config_fc"). i(t Distribution(R"iR"is--help-fcompileriRR&sshow_fcompilers: %s not founds fcompiler=is (%s)sFortran compilers found:s5Compilers available for this platform, but not found:s)Compilers not available on this platform:s>For compiler details, run 'config_fc --verbose' setup command.N(&Rbtdistutils.distR`t'numpy.distutils.command.config_compilerR"RRRRtargvt script_namet script_argstremoveR{tcmdclasstparse_config_filestparse_command_lineR<RKR[Rt set_verbosityRR&RRRRR%RRRtlistRRRRt print_help(RR`R"R;t compilers_nat compilers_nitplatform_compilersRRyRRht_[1]tfcR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyR;sd          "/        cCs4tdd\}}|id|i|d S(Ntsuffixs.fs# subroutine dummy() end i(Rtwritetclose(tfoR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyRws  s.*[.](for|ftn|f77|f)\Zs-[*]-\s*fortran\s*-[*]-s-[*]-\s*f90\s*-[*]-s-[*]-\s*fix\s*-[*]-s[^c*!]\s*[^\s\d\t]cCsd}t|d}|i}d}t|o d}nt|od}d}nx|djo|o|i}|o]|ddjoL|d8}|ddjot|d p|dd jo d}Pqn|i}q^W|i|S( s(Check if file is in free format Fortran.itri'it!s iit&(topentreadlinet _has_f_headert_has_f90_headertrstript_free_f90_startRt(tfiletresulttftlinetn((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyRs(       3  cCs<t|d}|i}|it|p t|S(NRv(RyRzRtR|t_has_fix_header(RRR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyRs  s=(c|)f77flags\s*\(\s*(?P\w+)\s*\)\s*=\s*(?P.*)cCsh}t|d}d}x|iD]y}|d7}|djoPnti|}|pq(n|idi}|idi}t|||)=` Return a dictionary {:}. RviiitfcnameRR(Ryt readlinest _f77flags_reRWtgroupRR Rt(RRPRtiRtmRRR((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyRs     t__main__(HRt__all__RRRVRiRt NameErrortsetsRtdistutils.sysconfigRRtdistutils.fancy_getoptRtdistutils.errorsRR R R R tdistutils.utilR Rtnumpy.distutils.ccompilerRRtnumpy.distutilsRtnumpy.distutils.misc_utilRRRRtnumpy.distutils.environmentRtnumpy.distutils.exec_commandRttypet __metaclass__t ExceptionRRRR RRURbR<R>RKRcRTR[R\RRRtcompiletIRWRtsearchR{R|RR~RRRRR(((sH/usr/lib64/python2.6/site-packages/numpy/distutils/fcompiler/__init__.pyts      ("   s  "    <