tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
L\¬Qc@sZdZddlmZedddƒ[ddlZddlZddlZddlZddlZddd    gZe    d
ƒZ
e    eƒZ ddd „ƒYZ ddd „ƒYZ er¾d pÁdZdeZd„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.cCsEt|tƒrt|ƒ}n|d|_||_|j|d<dS(s8Install this ImportManager into the specified namespace.t
__import__N(t
isinstancet _ModuleTypetvarstprevious_importert    namespacet _import_hook(tselfR ((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pytinstall!s
     cCs|j|jd<dS(s&Restore the previous import mechanism.RN(R
R (R ((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt    uninstall1scCs|jj||ƒdS(N(tfs_impt
add_suffix(R tsuffixt
importFunc((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR5scCsžtstƒn|dkr7|jp(t}|ƒ}n||_xGtjƒD]9}|dtjkrM|j    |dt
|ƒj ƒqMqMW|j    dt ƒdS(Niis.py( t_os_statt _os_bootstraptNonetclsFilesystemImportert_FilesystemImporterRtimpt get_suffixest C_EXTENSIONRtDynLoadSuffixImportert import_filetpy_suffix_importer(R Rtclstdesc((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt__init__@s
       c
CsS|jdƒ}|j|ƒ}|rI|jj|||ƒ}|rI|Snytj|d}Wn:tk
rš|j|dƒ}|s›td|‚q›nXt    |ƒdkrÐ|s·|S|j
j dƒsÐ|Sn|j
j dƒ}    |    rÿ|    j ||d|ƒSt    |ƒdkrBt ||dƒrB|r;t||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((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR Vs2 %cCsz| s|jdƒ rdS|d}|dr@tj|}|S|jdƒ}|dkr_dS|| }tj|}|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((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR&•s    
 
 
 cCsXxQtjD]F}t|tƒr7|jj||ƒ}n|j|ƒ}|r
|Sq
WdS(N(R(tpathRt _StringTypeRtimport_from_dirt
import_topR(R tnametitemR9((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR+¼scCs(|jjdƒ}|sntd‚dS(s*Python calls this hook to reload a module.R$sreload not yet implementedN(R.R/t SystemError(R R9R;((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt _reload_hookÈsN(R<t
__module__t__doc__R    t __builtin__RRRRRR!R R&R+RG(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRs             ?    '     cBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
RS(    s3Base class for replacing standard import functions.cCs|jd||ƒS(sImport a top-level module.N(t _import_oneR(R RD((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRCÜscCs<|j||ƒ}|s|S|jr8|j||ƒn|S(N(t
_load_tailR#t_import_fromlist(R ttopR7R6tbottom((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR0äs     cCswytj|SWntk
r"nX|j|||ƒ}|dkrHdS|j||ƒ}|rst|||ƒn|S(sImport a single module.N(R(R)R*tget_codeRt_process_resulttsetattr(R R8tmodnameR3tresultR9((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRKs  cBsÆ|\}}}e|eƒ}|r-|}nej|ƒ}||_||_|jj|ƒ|ej    |<|s¬y||jUWq¬|ej    kr¢ej    |=n‚q¬Xnej    |}||_
|S(N( RRRt
new_moduleR$R#R.tupdateR(R)R<(R RTR3tispkgtcodetvaluest    is_moduleR9((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRQs&              
     cCsSxL|D]D}d|j|f}|j|||ƒ}|std|‚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((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRLAs  cCs¦d|kr4t|ƒt|jjdgƒƒ}nxk|D]c}|dkr;t||ƒ r;d|j|f}|j|||ƒ}|sžtd|‚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((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRMMs      cCsQ|d}|jd|}|j|||ƒ}|s:dS|j||d|ƒS(s¨Attempt to import the module relative to parent.
 
        This method is used when the import context specifies that <self>
        imported the parent module.
        iR"iN(R<RKRR0(R R8R7R6ttop_namet
top_fqnameR:((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/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((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRPrs( R<RHRIRCR0RKRQRLRMR'RP(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRÙs        #        %            tctos.pycCsét|dƒjƒ}|r8|ddkr8|d}ntj||dƒ}yt|tdƒ}Wntk
rwnnX|jdƒ|jtjd|ƒƒt    j
||ƒ|j ƒ|j ddƒ|jt jƒƒ|jƒ|S(    sNCompile (and cache) a Python source file.
 
    The file specified by <pathname> 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<Ii(topentreadRJtcompilet _suffix_chartIOErrortwritetstructtpacktmarshaltdumptflushtseekRt    get_magictclose(tpathnamet    timestampt
codestringRXtf((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt_compileŸs 
 
 
cCs×tj}d }d|kr4d}ddlm}nxd|krYd}ddlm}nSd|kr~d}ddlm}n.d|kr£d}ddlm}n    td    ‚|d krÇ|d
„}n|a    |a
d S( sISet up 'os' module replacement functions for use during import bootstrap.tposixt/iÿÿÿÿ(tstattnts\tdostos2sno os specific module foundcSsF|dkr|S|d}|dks2||kr:||S|||S(NRiÿÿÿÿR((tatbtseptlastchar((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pytjoinÕs  
N( R(tbuiltin_module_namesRR€R‚RƒR„R…R,Rt _os_path_join(tnamesRŠRˆR‚((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR¿s&                 cCs6yt|ƒ}Wntk
r$dSX|jd@dkS(s&Local replacement for os.path.isdir().iði@N(RtOSErrorRtst_mode(R{ts((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt_os_path_isdirãs
 cCs2yt|ƒ}Wntk
r$dSXt|jƒS(s,Return the file modification time as a Long.N(RRŽRtlongtst_mtime(R{R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt
_timestampës
 cBseZd„ZRS(cCsr|r
dStj|ƒr%tj}ntj|ƒr@tj}ndStj|d|dd|fƒ}d|ifS(NRi(RRt
is_builtint    C_BUILTINt    is_frozent    PY_FROZENt load_module(R R8RSR3ttypeR9((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRPùs  !(R<RHRP(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRøsRcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs g|_dS(N(tsuffixes(R ((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR!scCs|jj||fƒdS(N(R›tappend(R RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRscCs5|jt||ƒ|ƒ}|r1|j||ƒSdS(N(t_import_pathnameRŒRQR(R tdirR3RT((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRBscCs[x<|jD]1}|jt||ƒ|ƒ}|dk    r
|Sq
W|jt|j|ƒ|ƒS(N(t__path__RRŒRt
__pkgdir__(R R8RSR3tsubmodule_pathRX((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRPs  c    Cs¿t|ƒrc|jt|dƒ|ƒ}|r_|d}||d<|g|d<d|d|fSdSxU|jD]J\}}||}yt|ƒ}Wntk
r¦qmX||||ƒSqmWdS(NR!iR RŸi(R‘RRŒRR›RRŽ(    R R{R3RTRYRRtfilenametfinfo((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR,s"     
 
 
 (R<RHR!RRBRPR(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRs
                c    Cs÷|d t}t|dƒ}t|ƒ}d}|dk    r¿||kr¿t|dƒ}|jdƒtjƒkr²tj    d|jdƒƒd}||kr²t
j |ƒ}q²n|j ƒn|dkrã|}t ||ƒ}nd|i|d6fS(Niýÿÿÿitrbis<Iit__file__(t_suffixR’R”RRmRnRRyRstunpackRutloadRzR(    R¢R£R3tfilett_pytt_pycRXR~tt((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRFs    RcBseZd„Zd„ZRS(cCs ||_dS(N(R (R R ((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR!ZscCsGt||jdƒ}tj||||jƒ}||_d|ifS(Nii(RmR RR™R¥(R R¢R£R3tfpR9((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyR]s    (R<RHR!R(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyRYs    cCs^tjjƒ}|jƒx>|D]6\}}|rM|G|jjddƒGHq |GdGHq WdS(NR$s-- no importers-- non-existent module(R(R)titemstsortR.R/(R®RDR9((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt_print_importersfs 
cCs'tƒjƒtjjdtƒƒdS(Ni(RRR(R@tinsertR(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt _test_revampos ((((RItwarningsRRR(RJRsRuR^RšRARRRt    __debug__RpR¦RRRRŒRR‘R”RRRRR°R²(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/imputil.pyt<module> s4       »Á
    
    $         6