Ñò §ÚêLc @s\dZddklZedddƒ[ddkZddkZddkZddkZddkZddd gZe d ƒZ e eƒZ ddd „ƒYZ ddd „ƒYZ eod pdZdeZd„Zdaad„Zd„Zd„Zd e fd„ƒYZde fd„ƒYZd„Zddd„ƒYZd„Zd„ZdS(s Import utilities Exported classes: ImportManager Manage the import process Importer Base class for replacing standard import functions BuiltinImporter Emulate the import mechanism for builtin and frozen modules DynLoadSuffixImporter iÿÿÿÿ(twarnpy3ks1the imputil module has been removed in Python 3.0t stackleveliNt ImportManagertImportertBuiltinImportertcBsqeZdZeeƒd„Zd„Zd„Zd Z d d„Z d d d d„Z d„Z d„Z d„ZRS( sManage the import process.cCsGt|tƒot|ƒ}n|d|_||_|i|dtj o2|i|dƒ}|ptd|‚q£nXt |ƒdjo(|p|S|i i dƒp|Sn|i i dƒ} | o| i ||d|ƒSt |ƒdjo5t ||dƒo!|ot||dƒS|Sntd|‚dS( s5Python calls this hook to locate and import a module.t.isNo module named it __ispkg__t __importer__iN(tsplitt_determine_import_contextR$t _do_importtsystmodulestKeyErrort_import_top_modulet ImportErrortlent__dict__tgett_finish_importthasattrtgetattr( R tfqnametglobalstlocalstfromlisttpartstparenttmodulet top_moduletimporter((s/usr/lib64/python2.6/imputil.pyR Vs2  'cCs| p|idƒ odS|d}|doti|}|S|idƒ}|djodS|| }ti|}|S(sJReturns the context in which a module should be imported. The context could be a loaded (package) module and the imported module will be looked for within that package. The context could also be None, meaning there is no context -- the module should be looked for as a "top-level" module. R$t__name__R#R"iÿÿÿÿN(R/RR(R)trfind(R R4t parent_fqnameR8ti((s/usr/lib64/python2.6/imputil.pyR&•s       cCs\xUtiD]J}t|tƒo|ii||ƒ}n|i|ƒ}|o|Sq WdS(N(R(tpathRt _StringTypeRtimport_from_dirt import_topR(R tnametitemR9((s/usr/lib64/python2.6/imputil.pyR+¼s  cCs*|iidƒ}|pntd‚dS(s*Python calls this hook to reload a module.R$sreload not yet implementedN(R.R/t SystemError(R R9R;((s/usr/lib64/python2.6/imputil.pyt _reload_hookÈsN(R<t __module__t__doc__R t __builtin__RRRRRR!R R&R+RG(((s/usr/lib64/python2.6/imputil.pyRs   ? ' cBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s3Base class for replacing standard import functions.cCs|id||ƒS(sImport a top-level module.N(t _import_oneR(R RD((s/usr/lib64/python2.6/imputil.pyRCÜscCs@|i||ƒ}|p|S|io|i||ƒn|S(N(t _load_tailR#t_import_fromlist(R ttopR7R6tbottom((s/usr/lib64/python2.6/imputil.pyR0äs  cCs}yti|SWntj onX|i|||ƒ}|djodS|i||ƒ}|ot|||ƒn|S(sImport a single module.N(R(R)R*tget_codeRt_process_resulttsetattr(R R8tmodnameR3tresultR9((s/usr/lib64/python2.6/imputil.pyRKs cBsÌ|\}}}e|eƒ}|o |}nei|ƒ}||_||_|ii|ƒ|ei |<|p>y||iUWq²|ei joei |=n‚q²Xnei |}||_ |S(N( RRRt new_moduleR$R#R.tupdateR(R)R<(R RTR3tispkgtcodetvaluest is_moduleR9((s/usr/lib64/python2.6/imputil.pyRQs&       cCsUxN|D]F}d|i|f}|i|||ƒ}|ptd|‚qqW|S(sˆImport the rest of the modules, down from the top-level module. Returns the last module in the dotted list of modules. s%s.%ssNo module named (R<RKR,(R tmR7tpartR3((s/usr/lib64/python2.6/imputil.pyRLAscCs­d|jo)t|ƒt|iidgƒƒ}nxp|D]h}|djoUt||ƒ oDd|i|f}|i|||ƒ}|ptd|‚q¥q=q=WdS(s*Import any sub-modules in the "from" list.t*t__all__s%s.%sscannot import name N(tlistR.R/R1R<RKR,(R tpackageR6tsubtsubnametsubmod((s/usr/lib64/python2.6/imputil.pyRMMs   cCsS|d}|id|}|i|||ƒ}|pdS|i||d|ƒS(s¨Attempt to import the module relative to parent. This method is used when the import context specifies that imported the parent module. iR"iN(R<RKRR0(R R8R7R6ttop_namet top_fqnameR:((s/usr/lib64/python2.6/imputil.pyR'_s  cCs td‚dS(s£Find and retrieve the code for the given module. parent specifies a parent module to define a context for importing. It may be None, indicating no particular context for the search. modname specifies a single module (not dotted) within the parent. fqname specifies the fully-qualified module name. This is a (potentially) dotted name from the "root" of the module namespace down to the modname. If there is no parent, then modname==fqname. This method should return None, or a 3-tuple. * If the module was not found, then None should be returned. * The first item of the 2- or 3-tuple should be the integer 0 or 1, specifying whether the module that was found is a package or not. * The second item is the code object for the module (it will be executed within the new module's namespace). This item can also be a fully-loaded module object (e.g. loaded from a shared lib). * The third item is a dictionary of name/value pairs that will be inserted into new module before the code object is executed. This is provided in case the module's code expects certain values (such as where the module was found). When the second item is a module object, then these names/values will be inserted *after* the module has been loaded/initialized. sget_code not implementedN(t RuntimeError(R R8RSR3((s/usr/lib64/python2.6/imputil.pyRPrs( R<RHRIRCR0RKRQRLRMR'RP(((s/usr/lib64/python2.6/imputil.pyRÙs  #  %  tctos.pycCsît|dƒiƒ}|o|ddjo|d}nti||dƒ}yt|tdƒ}Wntj onoX|idƒ|itid|ƒƒt i ||ƒ|i ƒ|i ddƒ|it iƒƒ|iƒ|S( sNCompile (and cache) a Python source file. The file specified by is compiled to a code object and returned. Presuming the appropriate privileges exist, the bytecodes will be saved back to the filesystem for future imports. The source file's modification timestamp must be provided as a Long value. trUiÿÿÿÿs texectwbts|iD]3}|it||ƒ|ƒ}|dj o|Sq W|it|i|ƒ|ƒS(N(t__path__RŸRŽRt __pkgdir__(R R8RSR3tsubmodule_pathRX((s/usr/lib64/python2.6/imputil.pyRP(s   c CsÅt|ƒoZ|it|dƒ|ƒ}|o3|d}||d<|g|d s4       »Á    .  6