r$Lc@sEdZdZddkZddkZddkZddkZddkZddkZddk Zddk Zddk Zddk Zddk ZddkZddkZddkZddkZddklZdei_dei_eaddgZdZdZdZd Zd Zead Z ei!i"a#d Z$ea%da&ha'ha(ea)d Z*dZ+dZ,dei-i.fdYZ/ei-i0e/dei1i2fdYZ3de3fdYZ4de3fdYZ5dZ6dZ7dei8i9i:fdYZ;de<fdYZ=dei>i?fdYZ@d e<fd!YZAd"e<fd#YZBd$ZCeed%ZDd&ed'ZEd&eed(ZFd&ed)ZGd*d+ZHd,ed-ZId.ZJd/ZKd0ZLd1ZMd*d2ZNd*d3ZOed4eed d5ZPed d6ZQdS(7s2SCons.SConf Autoconf-like configuration support. s8src/engine/SCons/SConf.py 5023 2010/06/14 22:05:46 sconsiN(tTraceitcleanthelpcCs |adS(N(t build_type(ttype((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt SetBuildType;siicCsY|djo tan?|djo tan(|djo tantd|dS(sRSet the Configure cache mode. mode must be one of "auto", "force", or "cache".tautotforcetcaches'SCons.SConf.SetCacheMode: Unknown mode N(tAUTOt cache_modetFORCEtCACHEt ValueError(tmode((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt SetCacheModeGs      cCs |adS(s:Set the progress display to use (called from SCons.Script)N(tprogress_display(tdisplay((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytSetProgressDisplayUscCstt|dd}tiddt|di}|idh|d6|i|di|idh|d6|idS(Nitws [^A-Za-z0-9_]t_s3#ifndef %(DEFNAME)s_SEEN #define %(DEFNAME)s_SEEN tDEFNAMEs #endif /* %(DEFNAME)s_SEEN */ (topentstrtretsubtuppertwritet get_contentstclose(ttargettsourcetenvtttdefname((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt_createConfigHas%cCsdt|dS(Nsscons: Configure: creating i(R(RRR ((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt_stringConfigHnscCsttdjodStiitt}tiid|}|idh|d6x1tiD]#}|i ||i t|qfWdS(s5Called just before the building targets phase begins.iNtactiontBUILDERStSConfigHBuilder( tlent _ac_config_hstSConstActionR#R$tBuildertAppendtkeysR'tValue(R R%t sconfigHBldtk((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytCreateConfigHBuilderqs   t SConfWarningcBseZRS((t__name__t __module__(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR3|st SConfErrorcBseZdZRS(cCstiii||dS(N(R*tErrorst UserErrort__init__(tselftmsg((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR9s(R4R5R9(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR6stConfigureDryRunErrorcBseZdZdZRS(stRaised when a file or directory needs to be updated during a Configure process, but the user requested a dry-runcCsQt|tiiipdt|}ndt|}ti||dS(Ns8Cannot create configure directory "%s" within a dry-run.s3Cannot update configure test "%s" within a dry-run.(t isinstanceR*tNodetFStFileRR6R9(R:RR;((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR9s(R4R5t__doc__R9(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR<stConfigureCacheErrorcBseZdZdZRS(sbRaised when a use explicitely requested the cache feature, but the test is run the first time.cCsti|dt|dS(Ns*"%s" is not yet built and cache is forced.(R6R9R(R:R((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR9s(R4R5RAR9(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRBscCs>tt|dd}|i|di|idS(NiR(RRRRR(RRR tfd((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt _createSourcescCs,t|dd|diiddS(Nis <- |s s |(RRtreplace(RRR ((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt _stringSourcestSConfBuildInfocBs#eZdZdZdZdZRS(s Special build info for targets of configure tests. Additional members are result (did the builder succeed last time?) and string, which contains messages of the original build phase. cCs||_||_dS(N(tresulttstring(R:RHRI((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytset_build_results N(R4R5RAtNoneRHRIRJ(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRGstStreamercBs;eZdZdZdZdZdZdZRS(sR 'Sniffer' for a file-like writable object. Similar to the unix tool tee. cCs||_ti|_dS(N(torigtiotStringIOts(R:RM((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR9s cCs2|io|ii|n|ii|dS(N(RMRRP(R:R((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs cCs&x|D]}|i|dqWdS(Ns (R(R:tlinestl((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt writelinesscCs |iiS(sS Return everything written to orig since the Streamer was created. (RPtgetvalue(R:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRTscCs,|io|iin|iidS(N(RMtflushRP(R:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRUs (R4R5RAR9RRSRTRU(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRLs     tSConfBuildTaskcBs;eZdZdZdZdZdZdZRS(s This is almost the same as SCons.Script.BuildTask. Handles SConfErrors correctly and knows about the current cache_mode. cCs*tiotiid|dndS(Nsscons: Configure: s (t sconf_globalt logstreamR(R:tmessage((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs cCs\t|tptiitd|in+|iddt|i i dddS(sc Logs the original builder messages, given the SConfBuildInfo instance bi. s8The stored build information has an unexpected class: %ss!The original builder output was: s |s s |N( R=RGR*tWarningstwarnR3t __class__RRRIRE(R:tbi((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytdisplay_cached_strings   cCs|id}t|tonyt|tiio|inU|id|idy t i }Wnt j od}nX||iti i i|S(Nis&Caught exception while building "%s": cSsti||G|GHdS(N(t tracebacktprint_tb(Rtvaluettb((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt excepthooks (texc_infot issubclassR6R*R7t BuildErrort exc_clearRttargetstsysRctAttributeErrort TaskmastertTasktfailed(R:texc_typeRc((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRms  cCsd}t}t}t}x~|iD]s}|otd|n|ii}t|to|otdntt jo,|i t i i |otdq5n|otd|in|otd|in|it i i jo|io t}n|otd|n|p|i}q"|otdnt}|it i i j}|otd|q"q"W|otd n| ||fS( Nis%ss: SConfBuildInfos: set_state(up_to-date)s: get_state() %ss: changed() %ss : changed %ss: elses (tFalsetTrueRhRtget_stored_infotbinfoR=RGR R t set_stateR*R>t up_to_datet get_statetchangedRH(R:tTRvt cached_errortcachableR!R]((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytcollect_node_statessD  & c Cs|idipdSt}|i\}}}ttjo| ot|idnttjo d}n|oX|oQ|idt |id|idi i }|i |t iin|oE|idt |id|idi i }|i |nktot|idnMtti}t_t_y|idi}ttjo:|id}|ii|ij o|i|qn||d<|dR?t default_fstfstpathTopRWRKR7R8R R@tsubsttlogfileRXt lastTargettdepthRRRRRRRRRRRRRRtAddTeststDirtconfdirtconfig_ht_startup(R:R t custom_teststconf_dirtlog_fileRt_deptht default_tests((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR9sD              cCs|i|iS(s^Call this method after finished with your tests: env = sconf.Finish() (t _shutdownR (R:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytFinishs cCsg}|od|}|i|n|dj od||f}n d|}|i||id|idi||_dS(s Define a pre processor symbol name, with the optional given value in the current config header. If value is None (default), then #define name is written. If value is not none, then #define name value is written. comment is a string which will be put as a C comment in the header, to explain the meaning of the value (appropriate C comments /* and */ will be put automatically.s/* %s */s #define %s %ss #define %sts N(tappendRKt config_h_texttjoin(R:RRatcommentRQt comment_strt define_str((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytDefines      c Cs|idj o.ti}|it_ti}|it_nti}ti}titi ddx|D]}|i |_ qsWd}zti }ti dtii|t} tiid| } | ixJ|D]B}|i} | tiijo| tiijo d}qqWWdti |ti|ti|dd|idj o|t_|t_nX|S(sg Tries to build the given nodes immediately. Returns 1 on success, 0 on error. t change_os_diriiN(RXRKRiRRRtgetcwdtostchdirtToptdo_not_store_infot store_infot get_max_driftt set_max_driftR*RkRVtJobtJobstrunRuR>texecutedRt( R:tnodest oldStdoutt oldStderrt old_fs_dirt old_os_dirtntrettsave_max_driftttmtjobststate((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt BuildNodess>            cCs%|i||||||i|iS(sWrapper function for handling piped spawns. This looks to the calling interface (in Action.py) like a "normal" spawn, but associates the call with the PSPAWN variable from the construction environment and with the streams to which we want the output logged. This gets slid into the construction environment as the SPAWN variable so Action.py doesn't have to know or care whether it's spawning a piped command or not. (tpspawnRX(R:tshtescapetcmdtargsR ((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytpspawn_wrappers RcCsy|id|_Wn%tj otiidnXy|id}Wn%tj otiidnXg}dtt}|ii|i i }|ii|i i }|i i |||} z|i|id<|ii|} |dj oH|i i ||} |iid| d| } |i| | } nd} |d| d| }tii|p |g}n|i||i|}Wd||id and optional source file extension , Returns the status (0 : failed, 1 : ok) and the contents of the output file. R%R&tSConfActionBuilderiiR(iR(R*R,R R-RRRR(R:R%RRRtokt outputStr((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt TryActionFs cCs|i|ii||S(sCompiles the program given in text to an env.Object, using extension as file extension (e.g. '.c'). Returns 1, if compilation was successful, 0 otherwise. The target is saved in self.lastTarget (for further processing). (RR tObject(R:RR((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt TryCompileUscCs|i|ii||S(sCompiles the program given in text to an executable env.Program, using extension as file extension (e.g. '.c'). Returns 1, if compilation was successful, 0 otherwise. The target is saved in self.lastTarget (for further processing). (RR tProgram(R:RR((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytTryLink]sc Cs|i||}|o|i}|i}|iitii|d}|ii|||ddgg}|i |}|o|i }d|fSndS(sCompiles and runs the program given in text, using extension as file extension (e.g. '.c'). Returns (1, outputStr) on success, (0, '') otherwise. The target (a file containing the program's stdout) is saved in self.lastTarget (for further processing). s.outt>s ${TARGET}iiR(iR( RRtpathRR@RtbasenameR tCommandRR( R:RRRtprogtpnametoutputtnodeR((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytTryRunes  "$ t TestWrappercBs eZdZdZdZRS(s)A wrapper around Tests (to ensure sanity)cCs||_||_dS(N(ttestR(R:RR((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyR9ys cOs|iiptiint|i}|i|||}|iidj o|ii |i|i_ n|i d|S(Nserror: no result( RtactiveR*R7R8t CheckContextRRRKRtResult(R:RtkwtcontextR((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt__call__|s  (R4R5RAR9R(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRws cCs t||ti||dS(sYAdds test_class to this SConf instance. It can be called with self.test_name(...)N(tsetattrRR(R:t test_namet test_instance((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pytAddTestscCs/x(|iD]}|i|||q WdS(sXAdds all the tests given in the tests dictionary to this SConf instance N(R.R(R:ttestsR((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs cCskt|}to'tii|pt|qgn.tii|pti|d|_ndS(Ni(RRRRtisdirR<tmakedirst_exists(R:R tdirName((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyt _createDirs  cCs|ii|_t|i_|i|i|iii|ig|id j ot o|it jo d}nd t |iR?RARDRHRJRLR3RN(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs&                cOs~|ittoZ|iddd|dcCsJt|d|\}}tii|||d|d|}d|_| S(s, A test for a C or C++ header file. iRTR](R_R*RURR/(RRSR]RTt prog_prefixt hdr_to_checkR:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs   cCs tii|}d|_| S(Ni(R*RURR/(RR:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs cCs tii|}d|_| S(Ni(R*RURR/(RR:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs cCs tii|}d|_| S(Ni(R*RURR/(RR:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs cCs tii|}d|_| S(Ni(R*RURR/(RR:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs cCst|||ddS(s% A test for a C header file. RTtC(R(RRSR]((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRscCst|||ddS(s' A test for a C++ header file. RTsC++(R(RRSR]((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRstmainc Csr|gjo dg}ntii|p |g}ntii|||d|d|d|}d|_| S(s A test for a library. See also CheckLibWithHeader. Note that library may also be None to test whether the given symbol compiles without flags. RSRTtautoaddiN(RKR*RRRURR/(RtlibrarytsymbolRSRTRdR:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs    c Cst|d\}}|gjo dg}ntii|p |g}ntii||d|d|d|d|}d|_| S(s1 Another (more sophisticated) test for a library. Checks, if library and header is available for language (may be 'C' or 'CXX'). Call maybe be a valid expression _with_ a trailing ';'. As in CheckLib, we support library=None, to test if the call compiles without extra link flags. itcallRTRdiN(R_RKR*RRRURR/( RtlibsRSRTRgRdR`tdummyR:((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyRs     (RRAt __revision__t SCons.compatR*RNRRRiR_t SCons.Actiont SCons.Buildert SCons.Errorst SCons.Jobt SCons.Node.FStSCons.Taskmastert SCons.UtiltSCons.WarningstSCons.Conftestt SCons.DebugRRUt LogInputFilestLogErrorMessagesRKRRORRR R R R RRRRRRRR%R)RWR#R$R2RZtWarningR3tenableWarningClassR7R8R6R<RBRDRFR>R?t FileBuildInfoRGR.RLRkt AlwaysTaskRVRRRRRRRRR_RRRRRRRRR(((s.install/lib/scons-2.0.0.final.0/SCons/SConf.pyts                          l