Ñò ®XRc@sèdZedjoddkiiZnddkZddkZddkZdZdZ de fd„ƒYZ edjode fd „ƒYZ nd eifd „ƒYZedjo(eid ZyÃeeid deƒZeieidƒZxaegZeD](Zeeeiƒƒeeiƒfq [ƒD]Zeiidefƒq>Weiƒ\ZZ eii!d„eDƒƒWnQe"j oZ#eiide#ƒn*e j oZ#eiide#ƒnXndS(sA standalone version of ModuleFinder which limits the depth of exploration for loaded modules and discovers where a module might be loaded instead of determining which path contains a module to be loaded. It is designed to be run by any version of python against its set of modules. To communicate its results to the process which ran it, it prints output to stdout. The format is to start a line with 'DEP ' if it contains information about a dependency, and 'ERR ' if it contains information about a module it couldn't analyze.t__main__iÿÿÿÿNs$PKGDEPEND_RUNPATHt PYTHONPATHt ModuleInfocBs>eZdZed„Zd„Zd„Zd„Zd„ZRS(sYThis class contains information about from where a python module might be loaded.cCs@||_||_ddddddg|_t|ƒ|_dS(s>Build a ModuleInfo object. The 'name' parameter is the name of the module. The 'dirs' parameter is the list of directories where the module might be found. The 'builtin' parameter sets whether the module is a python builtin (like sys).s.pys.pycs.pyos /__init__.pys.sos module.soN(tnametbuiltintsuffixestsortedtdirs(tselfRRR((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyt__init__*s   cCs'|iodg|_n g|_dS(s&Declare that this module is a package.s /__init__.pyN(RR(R((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyt make_package;s cCs4g}|iD]}|tii||iƒq~S(s8Get the directories where this package might be defined.(RtostpathtjoinR(Rt_[1]tp((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pytget_package_dirsCscCs/g}|iD]}|d|i|fq~S(sQReturn all the file names under which this module might be found.s%s%s(RR(RRtsuf((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pytget_file_namesHscCs)d|idi|iƒt|iƒfS(Nsname:%s suffixes:%s dirs:%st (RR RtlenR(R((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyt__str__Ns ( t__name__t __module__t__doc__tFalseR R RRR(((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyR&s     tMultipleDefaultRunPathscBseZd„Zd„ZRS(cCs t|ƒS(N(tstr(R((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyt __unicode__VscCs tdƒS(NsSMore than one $PKGDEPEND_RUNPATH token was set on the same action in this manifest.(t_(R((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyR]s(RRRR(((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyRTs tDepthLimitedModuleFindercBsweZd„Zed„ƒZd„Zd„Zd„Zdd„Zd d dd„Z d„Z d d „Z d „Z RS( c Osi|idgƒ}ttijoDg}tititiƒD]}|tii|ƒq@~}ng}g}tidD]$}|i ||ƒp ||q~q~~} | i |ƒ|oŠt djot i | |ƒ} qIyG|itƒ} || | || d}t|jo tƒ‚nWntj onX|} ntii|d| ||ŽdS(sùProduce a module finder that ignores PYTHONPATH and only reports the direct imports of a module. run_paths as a keyword argument specifies a list of additional paths to use when searching for modules.t run_pathsiRR N(tpopt python_pathR tenvirontsplittpathsepR tnormpathtsyststartswith_pathtappendRtbasetinsert_default_runpathtindextPD_DEFAULT_RUNPATHRt ValueErrort modulefindert ModuleFinderR ( Rt install_dirtargstkwargsRRtfptpy_patht_[2]tnew_pathR+((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyR es0='       cCs*x#|D]}|i|ƒotSqWtS(N(t startswithtTrueR(R tlsttl((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyR'šs  cCs"t|dƒ}|id||ƒS(sMFind all the modules the module at pathname directly imports.trR(topent load_module(RtpathnameR3((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyt run_script¡scCs|idd||od|ƒt|iƒd|dƒ}|i|ƒ}||_g}|oŽ|io|i|ƒ}n||_y|i|i ||ƒƒWqït j o8}|i ddt |ƒ||ƒ|i ||ƒqïXn|idd|ƒ|S(sôThis code has been slightly modified from the function of the parent class. Specifically, it checks the current depth of the loading and halts if it exceeds the depth that was given to run_script.iR=R3s texecs ImportError:sload_module ->(tmsgintcompiletreadt add_modulet__file__t replace_pathstreplace_paths_in_codet__code__textendt scan_codet ImportErrortmsgRt_add_badmoduletmsgout(RtfqnameR3R>tcotmtresRL((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyR=¨s"    c Csg}|i}tid jo |i}n |i}x||ƒD]‚\}}|djo|\}d|i|tj o2}|iddt|ƒƒ|i||ƒnjX|oax^|D]R}||ijo|i||ƒqn|i|i|||gd|ƒƒqWn|S(sMWrapper for self.import_hook() that won't raise ImportError. RWis ImportError:(t badmodulesRMRIt import_hookRKRLR(RRtcallerRhRWRRRLtsub((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyR_ñs$#c Cs_|djo&|idd||||ƒd}n|idd||||ƒ|i|d|ƒ}|i||ƒ\}}|p¯t|tƒo|iogSt|tiƒor|i}|i }|pH|t i jp |djot|gd t ƒgSt|gƒgSnt||ƒgS|gSn|i ||ƒ} |iƒ| i|ƒ| S( s5Find all the modules that importing name will import.sos.pathis/bypassing os.path import - importing os insteadR iRnRWt __future__R(RLR`tfind_head_packageRcRRR.tModuleRt__path__R&tbuiltin_module_namesR8t load_tailR R(( RRRoRhRWRktqttailR RR((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyRns2           c Csÿd}|idd|||ƒy|i|}Wntj onX|idd|ƒ|S||ijo|iddƒdS|o/|ip|iddƒdS|iƒ}ny|i|||ƒ}Wn't j o|idddƒdSX|S(s4Find where this module lives relative to its parent.it import_modulesimport_module ->simport_module -> NoneN( R^RAtmodulestKeyErrorRNRmRRt find_moduleRK(RtpartnameRORkt parent_dirsRQtmod((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyRy0s, cCsR|p>|tijp |djot|gdtƒS|i}nt||ƒS(saCalculate the potential paths on the file system where the module could be found.RqR(R&RuRR8R (RRR Rk((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyR|Ls  c Cs|idd||ƒg}|i}|}x|o‡|idƒ}|djot|ƒ}n|| ||d}}d||f}|i|||ƒ} |i| ƒ|}| }q.Wx/tdt|ƒdƒD]}||iƒq×W|idd|ƒ|S(shDetermine where each component of a multilevel import would be found on the file system.iRvt.iis%s.%ss load_tail ->( RARtfindRRyR(trangeR RN( RRwRxRRRt cur_parenttitheadtnew_nameR;((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyRvVs(    N(RRR t staticmethodR'R?R=RJR_R^RnRyR|Rv(((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyRcs 5   0 (  iiRisDEP %s ccsx|]}d|VqWdS(sERR %s N((t.0R((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pys €s sERR %s s%s ($RRtpkg.flavor.basetflavorR)R.R R&R,R!tobjectRt ExceptionRR/RtargvRtmfR?tloaded_modulestsetRRQttupleRRRRtstdouttwritetany_missing_maybetmissingtmaybet writelinesR-te(((s?/usr/lib/python2.6/vendor-packages/pkg/flavor/depthlimitedmf.pyts8    - ÿ  6