Ñò ¬éGc@sšdZddkZddkZddkZddklZddklZlZl Z l Z ei e ƒZ defd„ƒYZdd„Zd„ZdS( s:Implements an importer that looks only in specific path (ignoring sys.path), and uses a per-path cache in addition to sys.modules. This is necessary because test modules in different directories frequently have the same names, which means that the first loaded would mask the rest when using the builtin importer. iÿÿÿÿN(tConfig(t find_modulet load_modulet acquire_lockt release_locktImportercBs5eZdZdd„Zd„Zd„Zd„ZRS(s³An importer class that does only path-specific imports. That is, the given module is not searched for on sys.path, but only at the path or in the directory specified. cCs'|djo tƒ}n||_dS(N(tNoneRtconfig(tselfR((s1/usr/lib/python2.6/site-packages/nose/importer.pyt__init__s  cCsŽtiitii|ƒƒitiƒ}|idƒ}|didƒo|iƒn|t|ƒ }tii |ƒ}|i ||ƒS(sÌImport a dotted-name package whose tail is at path. In other words, given foo.bar and path/to/foo/bar.py, import foo from path/to/foo then bar from path/to/foo/bar, returning bar. t.iÿÿÿÿR ( tostpathtnormpathtabspathtsplittsept startswithtpoptlentjoint importFromDir(RR tfqnamet path_partst name_partstdir_path((s1/usr/lib/python2.6/site-packages/nose/importer.pytimportFromPaths*c Csñtiitii|ƒƒ}tid||ƒ|djo ti|S|ii ot ||iƒn|g}|i dƒ}d}d}}}xS|D]K} |djo | }nd|| f}zÀt ƒtid| ||ƒt| |ƒ\}} } tii|ƒ} | dj oStid|| ƒ|i| | ƒo | }qŠti|=t||| | ƒ}nt||| | ƒ}Wd|o|iƒntƒX|ot|| |ƒnt|d ƒo |i}n|}qžW|S( sˆImport a module *only* from path, ignoring sys.path and reloading if the version in sys.modules is not the one we want. sImport %s from %st__main__R ts%s.%ssfind module part %s (%s) in %sssys.modules has %s as %sNt__path__(R R R RtlogtdebugtsystmodulesRtaddPathstadd_pathRRRRtgett sameModuleRtcloseRtsetattrthasattrR( RtdirRR tpartst part_fqnametmodtparenttfhtparttfilenametdesctold((s1/usr/lib/python2.6/site-packages/nose/importer.pyR)sJ             cCsg}t|dƒoIx’|iD]7}|itiitiitii|ƒƒƒƒq WnMt|dƒo8|itiitiitii|iƒƒƒƒnt Stiitii|ƒƒ}x3|D]+}t i d||ƒ||jot SqÐWt S(NRt__file__s&module already loaded? mod: %s new: %s( R(RtappendR R tdirnameR RR3tFalseRRtTrue(RR,R0t mod_pathsR tnew_pathtmod_path((s1/usr/lib/python2.6/site-packages/nose/importer.pyR%`s*  !     N(t__name__t __module__t__doc__RR RRR%(((s1/usr/lib/python2.6/site-packages/nose/importer.pyRs    7cCs5tid|ƒ|pgSg}tii|ƒ}|o<tiitii|dƒƒo|it||ƒƒnE|t ijo4tid|ƒt ii d|ƒ|i |ƒn|on|i odxa|i D]R}tii||ƒ}tii |ƒo$t ii d|ƒ|i |ƒq×q×Wn|S(skEnsure that the path, or the root of the current package (if path is in a package) is in sys.path. s Add path %ss __init__.pysinsert %s into sys.pathi(RRR R R5texistsRtextendR#R tinsertR4tsrcDirstisdir(R RtaddedR-R5tdirpath((s1/usr/lib/python2.6/site-packages/nose/importer.pyR#ys(" cCs9tid|ƒ|tijotii|ƒndS(NsRemove path %s(RRR R tremove(R ((s1/usr/lib/python2.6/site-packages/nose/importer.pyt remove_path•s(R=tloggingR R t nose.configRtimpRRRRt getLoggerR;RtobjectRRR#RF(((s1/usr/lib/python2.6/site-packages/nose/importer.pyts   "i