³ò ”,9Mc@sqdZdZddkZddkZddkZddklZddklZddk l Z l Z l Z d„Z d„Zd „Zd „Zd „Zd d gZeddgZeiideiieedeƒdededdddƒZeddgZeiideiieedeƒdeiiideddddddgƒZd„Zd„ZdS(s Textfile/Substfile builder for SCons. Create file 'target' which typically is a textfile. The 'source' may be any combination of strings, Nodes, or lists of same. A 'linesep' will be put between any part written and defaults to os.linesep. The only difference between the Textfile builder and the Substfile builder is that strings are converted to Value() nodes for the former and File() nodes for the latter. To insert files in the former or strings in the latter, wrap them in a File() or Value(), respectively. The values of SUBST_DICT first have any construction variables expanded (its keys are not expanded). If a value of SUBST_DICT is a python callable function, it is called and the result is expanded as the value. Values are substituted in a "random" order; if any substitution could be further expanded by another subsitition, it is unpredictible whether the expansion will occur. s@src/engine/SCons/Tool/textfile.py 4629 2010/01/17 22:23:21 sconsiÿÿÿÿN(tNode(tValue(t is_Stringt is_Sequencetis_DictcCsK|iƒ}|p|Snx)|D]!\}}ti|||ƒ}q"W|S(s Fetch the node contents and replace all instances of the keys with their values. For example, if subs is {'%VERSION%': '1.2345', '%BASE%': 'MyProg', '%prefix%': '/bin'}, then all instances of %VERSION% in the file will be replaced with 1.2345 and so forth. (tget_text_contentstretsub(tnodetsubstcontentstktv((s8install/lib/scons-1.2.0.d20100117/SCons/Tool/textfile.pyt _do_subst:s  c Csü|d}|djo ti}nQt|ƒon@t|tƒo|iƒ}n tii dt |ƒdƒ‚|i dƒp d}nÁ|d}t |ƒo|i ƒ}n$t|ƒontii dƒ‚g}xm|D]e\}}t|ƒo |ƒ}nt|ƒo|i|ƒ}n t|ƒ}|i||fƒqåWyt|diƒdƒ}Wn5ttfj o#} tii d|dƒ‚nXd} xB|D]:} | o|i| ƒn|it| |ƒƒ|} q°W|iƒdS(Nt LINESEPARATORs+unexpected type/class for LINESEPARATOR: %st SUBST_DICTs#SUBST_DICT must be dict or sequenceitwbsCan't write target file %s(tNonetostlinesepRt isinstanceRRtSConstErrorst UserErrortreprthas_keyRtitemsRtcallabletsubsttstrtappendtopentget_pathtOSErrortIOErrortwriteR tclose( ttargettsourcetenvRR tdR R tfdtetlsepts((s8install/lib/scons-1.2.0.d20100117/SCons/Tool/textfile.pyt_actionHsN               cCs d|dS(Ns Creating '%s'i((R%R&R'((s8install/lib/scons-1.2.0.d20100117/SCons/Tool/textfile.pyt_strfuncxscCsgx`|D]X}t|ƒot||ƒqt|tƒo|i|ƒq|it|ƒƒqWdS(N(Rt_convert_list_RRRRR(tnewlisttsourcestelem((s8install/lib/scons-1.2.0.d20100117/SCons/Tool/textfile.pyR/{s cCsFt|ƒdjotiidƒ‚ng}t||ƒ||fS(NisOnly one target file allowed(tlenRRRR/(R%R&R'R0((s8install/lib/scons-1.2.0.d20100117/SCons/Tool/textfile.pyt _convert_listƒs  RRtTEXTFILEPREFIXtTEXTFILESUFFIXtactiontvarlisttsource_factorytemittertprefixs$TEXTFILEPREFIXtsuffixs$TEXTFILESUFFIXtSUBSTFILEPREFIXs$SUBSTFILEPREFIXs$SUBSTFILESUFFIXt src_suffixs.incCsUti|d-s<     0