Ñò rê$Lc@s–dZdZddkZddkZddkZddkZdZdZdZ d„Z de fd „ƒYZ d e fd „ƒYZ e ƒiZ[ dS( s;src/engine/SCons/PathList.py 5023 2010/06/14 22:05:46 sconss1SCons.PathList A module for handling lists of directory paths (the sort of things that get set as CPPPATH, LIBPATH, etc.) with as much caching of data and efficiency as we can while still keeping the evaluation delayed so that we Do the Right Thing (almost) regardless of how the variable is specified. iÿÿÿÿNiiicCsoy |i}WnRtj oFt|tiiƒptii|ƒo |}qkt|ƒ}n X|ƒ}|S(sƒ This is the "string conversion" routine that we have our substitutions use to return Nodes, not strings. This relies on the fact that an EntryProxy object has a get() method that returns the underlying Node that it wraps, which is a bit of architectural dependence that we might need to break or modify in the future in response to additional requirements. (tgettAttributeErrort isinstancetSConstNodetUtilt is_Sequencetstr(tobjRtresult((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyt node_conv1s  )  t _PathListcBs2eZdZd„Zd„Zd„Zd„ZRS(s$ An actual PathList object. cCsØtii|ƒo|itiƒ}n!tii|ƒp |g}ng}xs|D]k}y|idƒ}Wntt fj o t }nX|djo t }nt }|i ||fƒqVWt|ƒ|_dS(s¡ Initializes a PathList object, canonicalizing the input and pre-processing it for quicker substitution later. The stored representation of the PathList is a list of tuples containing (type, value), where the "type" is one of the TYPE_* variables defined above. We distinguish between: strings that contain no '$' and therefore need no delayed-evaluation string substitution (we expect that there will be many of these and that we therefore get a pretty big win from avoiding string substitution) strings that contain '$' and therefore need substitution (the hard case is things like '${TARGET.dir}/include', which require re-evaluation for every target + source) other objects (which may be something like an EntryProxy that needs a method called to return a Node) Pre-identifying the type of each element in the PathList up-front and storing the type in the list of tuples is intended to reduce the amount of calculation when we actually do the substitution over and over for each target. t$iÿÿÿÿN(RRt is_StringtsplittostpathsepRtfindRt TypeErrort TYPE_OBJECTtTYPE_STRING_NO_SUBSTtTYPE_STRING_SUBSTtappendttupletpathlist(tselfRtpltptindexttype((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyt__init__Is     cCs t|iƒS(N(tlenR(R((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyt__len__wscCs |i|S(N(R(Rti((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyt __getitem__ysc Cs¸g}x¥|iD]š\}}|tjoL|i|d|d|dtƒ}tii|ƒo|i|ƒqq’n|tjot|ƒ}n|o|i |ƒqqWt |ƒS(s‚ Performs construction variable substitution on a pre-digested PathList for a specific target and source. ttargettsourcetconv( RRtsubstR RRRtextendRRR(RtenvR#R$R Rtvalue((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyt subst_path{s      (t__name__t __module__t__doc__RR R"R*(((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyR Es  .  t PathListCachecBsheZdZeiioeiiZngZd„Z d„Z ei eii de ƒƒd„Z RS(sö A class to handle caching of PathList lookups. This class gets instantiated once and then deleted from the namespace, so it's used as a Singleton (although we don't enforce that in the usual Pythonic ways). We could have just made the cache a dictionary in the module namespace, but putting it in this class allows us to use the same Memoizer pattern that we use elsewhere to count cache hits and misses, which is very valuable. Lookup keys in the cache are computed by the _PathList_key() method. Cache lookup should be quick, so we don't spend cycles canonicalizing all forms of the same lookup key. For example, 'x:y' and ['x', 'y'] logically represent the same list, but we don't bother to split string representations and treat those two equivalently. (Note, however, that we do, treat lists and tuples the same.) The main type of duplication we're trying to catch will come from looking up the same path list from two different clones of the same construction environment. That is, given env2 = env1.Clone() both env1 and env2 will have the same CPPPATH value, and we can cheaply avoid re-parsing both values of CPPPATH by using the common value from this cache. cCs h|_dS(N(t_memo(R((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyR±scCs3tii|ƒottii|ƒƒ}n|S(sf Returns the key for memoization of PathLists. Note that we want this to be pretty quick, so we don't completely canonicalize all forms of the same list. For example, 'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically represent the same list if you're executing from $ROOT, but we're not going to bother splitting strings into path elements, or massaging strings into Nodes, to identify that equivalence. We just want to eliminate obvious redundancy from the normal case of re-using exactly the same cloned value for a path. (RRRRtflatten(RR((s1install/lib/scons-2.0.0.final.0/SCons/PathList.pyt _PathList_key´s tPathListc Cs…|i|ƒ}y|id}Wn&tj oh}||ids      KN