ó âqLc@s5dZdZddlZddlZddlZddlZddlZd„Zdej _ eej _ ga ia ej adagad„Zd„ZejjZd „Zd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZeadd„ZdS(sQSCons.SConsign Writing and reading information to the .sconsign file or files. s;src/engine/SCons/SConsign.py 5023 2010/06/14 22:05:46 sconsiÿÿÿÿNcCs!tjjtjjd|ƒdS(Ns#Ignoring corrupt .sconsign file: %s(tSConstWarningstwarntCorruptSConsignWarning(tfilename((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pytcorrupt_dblite_warning)sis .sconsigncCsk|jj}tjjtƒ r÷|jr÷d}xÆ|g|jD]±}|j|ƒrêyt||fSWqêt k ræ|j tƒ}yt j ||ƒ}t|s4         cCsgagadS(syReset global state. Used by unit tests that end up using SConsign multiple times to get a clean slate for each test.N(t sig_filesR(((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pytResetZscCs^xtD]}|jddƒqWx6tD].}y |j}Wntk rNq(X|ƒq(WdS(Ntsynci(R twriteRR"tAttributeError(tsig_fileRt syncmethod((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR#cs    t SConsignEntrycBs/eZdZdZd„Zd„Zd„ZRS(s  Wrapper class for the generic entry in a .sconsign file. The Node subclass populates it with attributes as it pleases. XXX As coded below, we do expect a '.binfo' attribute to be added, but we'll probably generalize this in the next refactorings. icCs |j}dS(N(tcurrent_version_id(tselft _version_id((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyt__init__xscCs|jjƒdS(N(tbinfotconvert_to_sconsign(R)((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR-|scCs|jj||ƒdS(N(R,tconvert_from_sconsign(R)Rtname((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR.~s(t__name__t __module__t__doc__R(R+R-R.(((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR'os   tBasecBsMeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(s This is the controlling class for the signatures for the collection of entries associated with a specific directory. The actual directory association will be maintained by a subclass that is specific to the underlying storage method. This class provides a common set of methods for fetching and storing the individual bits of information that make up signature entry. cCsi|_t|_i|_dS(N(tentriestFalsetdirtyt to_be_merged(R)((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR+Šs  cCs |j|S(s6 Fetch the specified entry attribute. (R4(R)R((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyt get_entryscCs||j|t get_ninfoR4(R)tkeyR@RARE((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR>¨s   ( R0R1R2R+R8R;R<RBRCR>(((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR3s      tDBcBs#eZdZd„Zdd„ZRS(s¬ A Base subclass that reads and writes signature information from a global .sconsign.db* file--the actual file suffix is determined by the database module. c CsMtj|ƒ||_t|ƒ\}}t|jƒ}y||}Wntk rXn½Xy:tj|ƒ|_ t |j t ƒs’i|_ t ‚nWnOt k r©‚n<tk rä}tjjtjjd|jj|fƒnXx-|j jƒD]\}}|j||ƒqõW|dkr<|j|_|j|_ntj|ƒdS(Ns*Ignoring corrupt sconsign entry : %s (%s) R(R3R+RRtnormcasettpathRtpickletloadsR4t isinstancetdictRtKeyboardInterruptt ExceptionRRRRRDR.R<R;RCRBR R( R)RRRR t rawentriesteRGRA((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR+½s0        icCs¶|js dS|jƒt|jƒ\}}t|jjƒ}x'|jjƒD]\}}|jƒqNWt j |jdƒ||<|r²y |j }Wnt k r§q²X|ƒndS(Ni( R6R>RRRIR R4RDR-RKtdumpsR"R$(R)R"RRR RGRAR&((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR#ås    (R0R1R2R+R#(((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyRH·s (tDircBseZddd„ZRS(cCsŠtj|ƒ|sdStj|ƒ|_t|jtƒsMi|_t‚n|r†x0|jjƒD]\}}|j ||ƒqcWndS(s8 fp - file pointer to read entries from N( R3R+RKtloadR4RMRNRRDR.(R)tfpRRGRA((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR+s   N(R0R1tNoneR+(((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyRTÿstDirFilecBs#eZdZd„Zdd„ZRS(sJ Encapsulates reading and writing a per-directory .sconsign file. cCs¹||_tjj|jdƒ|_yt|jdƒ}Wntk rSd}nXytj |||ƒWn:t k r‚n't j j t j jd|jƒnXtj|ƒdS(s2 dir - the directory for the file s .sconsigntrbs#Ignoring corrupt .sconsign file: %sN(RR R tjointsconsignRRRWRTR+RORRRRR R(R)RRV((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR+s    icCså|js dS|jƒtjj|jjdtjƒƒ}yt|dƒ}|}WnEtk rœyt|j dƒ}|j }Wqtk r˜dSXnXx'|j j ƒD]\}}|j ƒq­Wt j|j |dƒ|jƒ||j kr¶y=tj|j ƒd}tj|j dƒtj|j ƒWnttfk rLnXytj||j ƒWq¶tk r²t|j dƒjt|dƒjƒƒtj|j |ƒq¶Xnytj|ƒWnttfk rànXdS(s) Write the .sconsign file to disk. Try to write to a temporary file first, and rename it if we succeed. If we can't write to the temporary file, it's probably because the directory isn't writable (and if so, how did we build anything in this directory, anyway?), so try to write directly to the .sconsign file as a backup. If we can't rename, try to copy the temporary contents back to the .sconsign file. Either way, always try to remove the temporary file at the end. Ns.scons%dtwbiii¶RY(R6R>R R RZRtgetpidRRR[R4RDR-RKtdumptclosetstattchmodtunlinkRtrenameR#tread(R)R"ttemptfiletfnameRGRAR((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyR#.sB  %       ((R0R1R2R+R#(((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyRXs cCs@|dkrtadan!ta|a|dk r<|andS(sU Arrange for all signatures to be stored in a global .sconsign.db* file. N(RWRXt ForDirectoryRRHR (R/t dbm_module((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pytFilels   (R2t __revision__t SCons.compatRR RKt SCons.dblitetSCons.WarningsRtdblitetignore_corrupt_dbfilestcorruption_warningR RRR RRR!R RIR#tobjectR'R3RHRTRXRhRWRj(((s^/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/SConsign.pyts2             6HX