ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
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
M\¬Qc@s{dZddlZddlZddlmZyddlmZWn!ek
reddlmZnXddgZdefd„ƒYZ    d    efd
„ƒYZ
dddddd „Z dddddd „Z d „Zd„Zd„Zed„Zdded„Zd„Zd„Zddd„ZedkrweejƒdkrYejdIJqwejd=eejdƒndS(sZrunpy.py - locating and running Python code using the module namespace
 
Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.
 
This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts as well as when importing modules.
iÿÿÿÿN(t    read_code(t
get_loadert
run_moduletrun_patht _TempModulecBs)eZdZd„Zd„Zd„ZRS(sCTemporarily replace a module in sys.modules with an empty namespacecCs(||_tj|ƒ|_g|_dS(N(tmod_nametimpt
new_moduletmodulet _saved_module(tselfR((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt__init__s    cCsL|j}y|jjtj|ƒWntk
r7nX|jtj|<|S(N(RR    tappendtsystmodulestKeyErrorR(R
R((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt    __enter__s     cGs=|jr#|jdtj|j<n tj|j=g|_dS(Ni(R    R RR(R
targs((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt__exit__(s     (t__name__t
__module__t__doc__R RR(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyRs            t_ModifiedArgv0cBs#eZd„Zd„Zd„ZRS(cCs ||_tƒ|_|_dS(N(tvaluetobjectt _saved_valuet    _sentinel(R
R((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyR 0s    cCsE|j|jk    r!tdƒ‚ntjd|_|jtjd<dS(NsAlready preserving saved valuei(RRt RuntimeErrorR targvR(R
((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyR4scGs |j|_|jtjd<dS(Ni(RRRR R(R
R((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyR:s (RRR RR(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyR/s        c    BsJ|dk    r|j|ƒn|jd|d|d|d|ƒ||U|S(s)Helper to run code in nominated namespaceRt__file__t
__loader__t __package__N(tNonetupdate(tcodet run_globalst init_globalsRt    mod_fnamet
mod_loadertpkg_name((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt    _run_code>s cCsZt|ƒB}t|ƒ-|jj}t|||||||ƒWdQXWdQX|jƒS(s5Helper to run code in new namespace with sys modifiedN(RRRt__dict__R(tcopy(R"R$RR%R&R't temp_modulet mod_globals((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt_run_module_codeKs    cCs=x6dD].}t||dƒ}|dk    r||ƒSqWdS(Nt get_filenamet _get_filename(s get_filenames _get_filename(tgetattrR (tloaderRtattrtmeth((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyR/\s
  cCsüt|ƒ}|dkr+td|ƒ‚n|j|ƒr¯|dksU|jdƒrdtdƒ‚ny|d}t|ƒSWq¯tk
r«}tdd||fƒ‚q¯Xn|j|ƒ}|dkrÝtd|ƒ‚nt||ƒ}||||fS(NsNo module named %st__main__s    .__main__s%Cannot use package as __main__ modules%s; %r is a package and cannot sbe directly executedsNo code object available for %s(RR t ImportErrort
is_packagetendswitht_get_module_detailstget_codeR/(RR1t pkg_main_nameteR"tfilename((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyR8ds"  
 cCscd}yt|ƒSWnHtk
r^}|t|ƒkrXtd|tjdfƒ‚n‚nXdS(NR4scan't find %r module in %ri(R8R5tstrR tpath(t    main_nametexc((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt_get_main_module_detailsxsc        Cs×yF|s|dkr0t|ƒ\}}}}ntƒ\}}}}Wn9tk
r}dtjt|ƒf}tj|ƒnX|jdƒd}tjdj    }|r»|tj
d<nt ||dd|||ƒS(s¯Runs the designated module in the __main__ namespace
 
       Note that the executed module will have full access to the
       __main__ namespace. If this is not desirable, the run_module()
       function should be used to run the module code in a fresh namespace.
 
       At the very least, these variables in __main__ will be overwritten:
           __name__
           __file__
           __loader__
           __package__
    R4s%s: %st.iN( R8RAR5R t
executableR=texitt
rpartitionRR)RR(R (    Rt
alter_argvR1R"tfnameR@tmsgR't main_globals((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt_run_module_as_mainˆs  cCst|ƒ\}}}}|dkr-|}n|jdƒd}|r_t||||||ƒSt|i|||||ƒSdS(snExecute a module's code without importing it
 
       Returns the resulting top level namespace dictionary
    RBiN(R8R RER-R((RR$trun_namet    alter_sysR1R"RGR'((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyR¤s       cCs¤tj}y||}Wn†tk
rŸd||<x^tjD]+}y||ƒ}PWq;tk
req;Xq;Wytj|ƒ}Wntk
r‘dSX|||<nX|S(s5Python version of PyImport_GetImporter C API functionN(R tpath_importer_cacheRR t
path_hooksR5Rt NullImporter(t    path_nametcachetimporterthook((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt _get_importer¹s"     
   c    Csgt|dƒ}t|ƒ}WdQX|dkrct|dƒ}t|jƒ|dƒ}WdQXn|S(NtrbtrUtexec(topenRR tcompiletread(RGtfR"((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt_get_code_from_fileÕs  !c Cs<|dkrd}nt|ƒ}t|tjƒrRt|ƒ}t||||ƒStjj    d|ƒz§d}tj
|}tj
|=zt ƒ\}}}}    Wd|tj
|<Xd}
t |ƒH} t |ƒ3| jj} t|| |||    ||
ƒjƒSWdQXWdQXWdytjj|ƒWntk
r6nXXdS(s_Execute code located at the specified filesystem location
 
       Returns the resulting top level namespace dictionary
 
       The file path may refer directly to a Python script (i.e.
       one that could be directly executed with execfile) or else
       it may refer to a zipfile or directory containing a top
       level __main__.py script.
    s
<run_path>iR4Nt(R RTt
isinstanceRROR\R-R R>tinsertRRARRRR)R(R*tremovet
ValueError( RPR$RKRRR"R?t
saved_mainRR1RGR'R+R,((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyRßs0
       
   & R4is!No module specified for executioni(RR RtpkgutilRRR5t__all__RRRR R(R-R/R8RAtTrueRJtFalseRRTR\RRtlenRtstderr(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/runpy.pyt<module>s<                          
1