³ò ”,9Mc@sÑdZdZddkZddkZddkZddkZddkZe Z e Z e Z e Zd„Zd„ZeiieeƒZeiiedƒZd„ZeiiedƒZdd d„ƒYZdS( s;src/engine/SCons/CacheDir.py 4629 2010/01/17 22:23:21 sconss CacheDir support iÿÿÿÿNc Cs|d}|i}|iƒ}|i|ƒ\}}|i|ƒp|id||ƒdSn|id||ƒtiio€|i|ƒo |i |i |ƒ|i ƒn|i ||i ƒ|i |ƒ}|i|i t i|t iƒt iBƒndS(Nis$CacheRetrieve(%s): %s not in cache is'CacheRetrieve(%s): retrieving from %s (tfst get_CacheDirt cachepathtexistst CacheDebugtSConstActiontexecute_actionstislinktsymlinktreadlinktpathtcopy_from_cachetstattchmodtS_IMODEtST_MODEtS_IWRITE( ttargettsourcetenvttRtcdtcachedirt cachefiletst((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pytCacheRetrieveFunc*s     .cCsZ|d}|i}|iƒ}|i|ƒ\}}|ii|ƒod|iSndS(NisRetrieved `%s' from cache(RRRRR tNone(RRRRRRRR((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pytCacheRetrieveString<s   c Csô|d}|iodSn|i}|iƒ}|i|ƒ\}}|i|ƒo|id||ƒdSn|id||ƒ|dttiƒƒ}d} |i |ƒpdy|i |ƒWqt j o@|i |ƒp)| t|ƒ|f} t i i | ‚qqXny“|i|iƒo |i|i|iƒ|ƒn|i|i|ƒ|i||ƒ|i|iƒ} |i|ti| tiƒtiBƒWnBt j o6| t|ƒ|f} t iit ii| ƒnXdS(Nis+CachePush(%s): %s already exists in cache sCachePush(%s): pushing to %s s.tmps,Unable to copy %s to cache. Cache file is %s(tnocacheRRRRRtstrtostgetpidtisdirtmakedirstEnvironmentErrorRtErrorsRR R R tcopy2trenameR RRRRtWarningstwarntCacheWriteErrorWarning( RRRRRRRRttempfileterrfmttmsgR((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pyt CachePushFuncIs:     +tCacheDircBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsmyddk}Wn;tj o/d}tiitii|ƒd|_n X||_d|_d|_ dS(Niÿÿÿÿs<No hashlib or MD5 module available, CacheDir() not supported( thashlibt ImportErrorRR'R(tNoMD5ModuleWarningRR tcurrent_cache_debugtdebugFP(tselfR R/R,((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pyt__init__s  cCsœt|ijoPtdjoti|_n'tottdƒ|_n d|_t|_n|io.|ii||ti i |ƒdfƒndS(Nt-twi( t cache_debugR2tsyststdoutR3topenRtwriteRR tsplit(R4tfmtRR((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pyR‹s    cCsto |idj S(N(t cache_enabledR R(R4((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pyt is_enabled—scCse|iƒpdSn|iƒ}ti|dƒ}tii|i|ƒ}|tii||ƒfS(s iN(NN(R@Rtget_cachedir_bsigtstringtupperRR tjoin(R4tnodetsigtsubdirtdir((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pyRšs   cCs”|iƒptSn|iƒ}toAt|g|ddƒdjo|iddddƒtSqn(t|g|ddƒdjotSntS(sS This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built(). Note that there's a special trick here with the execute flag (one that's not normally done for other actions). Basically if the user requested a no_exec (-n) build, then SCons.Action.execute_actions is set to 0 and when any action is called, it does its showing but then just returns zero instead of actually calling the action execution operation. The problem for caching is that if the file does NOT exist in cache then the CacheRetrieveString won't return anything to show for the task, but the Action.__call__ won't call CacheRetrieveFunc; instead it just returns zero, which makes the code below think that the file *was* successfully retrieved from the cache, therefore it doesn't do any subsequent building. However, the CacheRetrieveString didn't print anything because it didn't actually exist in the cache, and no more build actions will be performed, so the user just sees nothing. The fix is to tell Action.__call__ to always execute the CacheRetrieveFunc and then have the latter explicitly check SCons.Action.execute_actions itself. texecuteiitpresub(R@tFalset get_build_envt cache_showtCacheRetrieveSilenttbuildtTruet CacheRetrieve(R4RER((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pytretrieve¥s   cCs+|iƒpdSnt|g|iƒƒS(N(R@t CachePushRL(R4RE((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pytpushÌs cCsto|i|ƒSndS(N(t cache_forceRT(R4RE((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pytpush_if_forcedÑs( t__name__t __module__R5RR@RRRRTRV(((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pyR.}s  ' ((t __revision__t__doc__tos.pathRR RBR9t SCons.ActionRRPR?RKR8RURMRRRRQRRNR-RSR.(((s3install/lib/scons-1.2.0.d20100117/SCons/CacheDir.pyss"        2