zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
U
G=®d«7ã@s
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl    Z    ddl
m Z ddl m Z mZddlZddlmZddlmZej d¡r¸ddlmmmmZn ejejZzeZWnek
rädZYnXeZ ddd    d
gZ!d-d d „Z"ej#d.d d„ƒZ$ej#dd„ƒZ%ej#dd„ƒZ&ej#dd„ƒZ'Gdd„de(ƒZ)Gdd„dƒZ*ej#dd„ƒZ+dd„Z,ej#dd„ƒZ-ej#dd „ƒZ.d!d"„Z/d#d$„Z0d%d
„Z1Gd&d„dƒZ2e3ed'ƒrÆej4gZ5ngZ5Gd(d„de2ƒZ6e 7ej8d)d*„d+ 9¡Dƒ¡Z:Gd,d    „d    eƒZ;dS)/éN)Úsix)ÚbuiltinsÚmap)ÚDistutilsError)Ú working_setÚjavaÚAbstractSandboxÚDirectorySandboxÚSandboxViolationÚ    run_setupc    CsJd}t||ƒ}| ¡}W5QRX|dkr.|}t||dƒ}t|||ƒdS)z.
    Python 3 implementation of execfile.
    ÚrbNÚexec)ÚopenÚreadÚcompiler )ÚfilenameÚglobalsÚlocalsÚmodeÚstreamÚscriptÚcode©rúID:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/sandbox.pyÚ    _execfile#s  rc
csDtjdd…}|dk    r$|tjdd…<z
|VW5|tjdd…<XdS©N)ÚsysÚargv)ÚreplÚsavedrrrÚ    save_argv0s 
r c
cs.tjdd…}z
|VW5|tjdd…<XdSr)rÚpath©rrrrÚ    save_path;s
r#ccs2tj|ddtj}|t_z
dVW5|t_XdS)zL
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    T)Úexist_okN)ÚosÚmakedirsÚtempfileÚtempdir)Ú replacementrrrrÚ override_tempDs 
r*c    cs.t ¡}t |¡z
|VW5t |¡XdSr)r%ÚgetcwdÚchdir)ÚtargetrrrrÚpushdUs
 
 
r.c@seZdZdZedd„ƒZdS)ÚUnpickleableExceptionzP
    An exception representing another Exception that could not be pickled.
    c    CsPzt |¡t |¡fWStk
rJddlm}| ||t|ƒƒ¡YSXdS)z‰
        Always return a dumped (pickled) type and exc. If exc can't be pickled,
        wrap it in UnpickleableException first.
        r)r/N)ÚpickleÚdumpsÚ    ExceptionÚsetuptools.sandboxr/ÚdumpÚrepr)ÚtypeÚexcÚclsrrrr4ds
 zUnpickleableException.dumpN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú staticmethodr4rrrrr/_sr/c@s(eZdZdZdd„Zdd„Zdd„ZdS)    ÚExceptionSaverz^
    A Context Manager that will save an exception, serialized, and restore it
    later.
    cCs|Srr©ÚselfrrrÚ    __enter__xszExceptionSaver.__enter__cCs |sdSt ||¡|_||_dS©NT)r/r4Ú_savedÚ_tb)r@r6r7ÚtbrrrÚ__exit__{s
zExceptionSaver.__exit__cCs6dt|ƒkrdSttj|jƒ\}}t |||j¡dS)z"restore and re-raise any exceptionrCN)Úvarsrr0ÚloadsrCrÚreraiserD)r@r6r7rrrÚresume†s zExceptionSaver.resumeN)r9r:r;r<rArFrJrrrrr>rs r>c    #sVtj ¡‰tƒ }ˆVW5QRXtj ˆ¡‡fdd„tjDƒ}t|ƒ| ¡dS)z 
    Context in which imported modules are saved.
 
    Translates exceptions internal to the context into the equivalent exception
    outside the context.
    c3s$|]}|ˆkr| d¡s|VqdS)z
encodings.N©Ú
startswith)Ú.0Úmod_namer"rrÚ    <genexpr>žs
ýzsave_modules.<locals>.<genexpr>N)rÚmodulesÚcopyr>ÚupdateÚ_clear_modulesrJ)Ú    saved_excZ del_modulesrr"rÚ save_moduless
 
ÿrUcCst|ƒD] }tj|=qdSr)ÚlistrrP)Z module_namesrNrrrrS©s rSc    cs$t ¡}z
|VW5t |¡XdSr)Ú pkg_resourcesÚ __getstate__Ú __setstate__r"rrrÚsave_pkg_resources_state®s
rZccs–tj |d¡}tƒxtƒftƒtƒNtƒ<t|ƒ(t    |ƒt
dƒdVW5QRXW5QRXW5QRXW5QRXW5QRXW5QRXdS)NÚtempÚ
setuptools) r%r!ÚjoinrZrUÚhide_setuptoolsr#r r*r.Ú
__import__)Ú    setup_dirÚtemp_dirrrrÚ setup_context·s
 
rbcCst d¡}t| |¡ƒS)aH
    >>> _needs_hiding('setuptools')
    True
    >>> _needs_hiding('pkg_resources')
    True
    >>> _needs_hiding('setuptools_plugin')
    False
    >>> _needs_hiding('setuptools.__init__')
    True
    >>> _needs_hiding('distutils')
    True
    >>> _needs_hiding('os')
    False
    >>> _needs_hiding('Cython')
    True
    z1(setuptools|pkg_resources|distutils|Cython)(\.|$))ÚrerÚboolÚmatch)rNÚpatternrrrÚ _needs_hidingÆs
rgcCstttjƒ}t|ƒdS)a%
    Remove references to setuptools' modules from sys.modules to allow the
    invocation to import the most appropriate setuptools. This technique is
    necessary to avoid issues such as #315 where setuptools upgrading itself
    would fail to find a function declared in the metadata.
    N)ÚfilterrgrrPrS)rPrrrr^Ûs r^c Csêtj tj |¡¡}t|ƒÄzˆ|gt|ƒtjdd…<tj d|¡t     
¡t    j   dd„¡t |tƒrl|n | t ¡¡}t|ƒt|dd}t||ƒW5QRXWn4tk
rÚ}z|jrÊ|jdrʂW5d}~XYnXW5QRXdS)z8Run a distutils setup script, sandboxed in its directoryNrcSs| ¡Sr)Úactivate)ÚdistrrrÚ<lambda>ïózrun_setup.<locals>.<lambda>Ú__main__)Ú__file__r9)r%r!ÚabspathÚdirnamerbrVrrÚinsertrÚ__init__Ú    callbacksÚappendÚ
isinstanceÚstrÚencodeÚgetfilesystemencodingr    ÚdictrÚ
SystemExitÚargs)Z setup_scriptr{r`Z dunder_fileÚnsÚvrrrr æs"
ÿ ý
 c@seZdZdZdZdd„Zdd„Zdd„Zd    d
„Zd d „Z    d d„Z
dD]Z e e e ƒrDe
e ƒeƒe <qDd$dd„ZerzedeƒZedeƒZdD]Z e e e ƒrˆee ƒeƒe <qˆdd„ZdD]Z e e e ƒr²ee ƒeƒe <q²dd„ZdD]Z e e e ƒrÜee ƒeƒe <qÜdd„Zdd„Zd d!„Zd"d#„ZdS)%rzDWrap 'os' module and 'open()' builtin for virtualizing setup scriptsFcs‡fdd„ttƒDƒˆ_dS)Ncs$g|]}| d¡stˆ|ƒr|‘qS)Ú_)rLÚhasattr)rMÚnamer?rrÚ
<listcomp>s
 
ÿz,AbstractSandbox.__init__.<locals>.<listcomp>)ÚdirÚ_osÚ_attrsr?rr?rrrs
ÿzAbstractSandbox.__init__cCs"|jD]}tt|t||ƒƒqdSr)r„Úsetattrr%Úgetattr)r@Úsourcer€rrrÚ_copy s
zAbstractSandbox._copycCs(| |¡tr|jt_|jt_d|_dSrB)rˆÚ_filerÚfileÚ_openrÚ_activer?rrrrAs
 
zAbstractSandbox.__enter__cCs$d|_trtt_tt_| t¡dS©NF)rŒr‰rrŠr‹rrˆrƒ)r@Úexc_typeÚ    exc_valueÚ    tracebackrrrrFs
zAbstractSandbox.__exit__c
Cs"||ƒW5QR£SQRXdS)zRun 'func' under os sandboxingNr)r@ÚfuncrrrÚrunszAbstractSandbox.runcsttˆƒ‰‡‡fdd„}|S)Ncs2|jr |jˆ||f|ž|Ž\}}ˆ||f|ž|ŽSr)rŒÚ _remap_pair)r@ÚsrcÚdstr{Úkw©r€ÚoriginalrrÚwrap&sz3AbstractSandbox._mk_dual_path_wrapper.<locals>.wrap©r†rƒ©r€r™rr—rÚ_mk_dual_path_wrapper#s
z%AbstractSandbox._mk_dual_path_wrapper)ÚrenameÚlinkÚsymlinkNcs ˆp ttˆƒ‰‡‡fdd„}|S)Ncs*|jr|jˆ|f|ž|Ž}ˆ|f|ž|ŽSr)rŒÚ _remap_input©r@r!r{r–r—rrr™4sz5AbstractSandbox._mk_single_path_wrapper.<locals>.wraprš)r€r˜r™rr—rÚ_mk_single_path_wrapper1sz'AbstractSandbox._mk_single_path_wrapperrŠr)ÚstatÚlistdirr,rÚchmodÚchownÚmkdirÚremoveÚunlinkÚrmdirÚutimeÚlchownÚchrootÚlstatÚ    startfileÚmkfifoÚmknodZpathconfÚaccesscsttˆƒ‰‡‡fdd„}|S)NcsB|jr2|jˆ|f|ž|Ž}| ˆˆ|f|ž|Ž¡Sˆ|f|ž|ŽSr)rŒr Ú _remap_outputr¡r—rrr™Isz4AbstractSandbox._mk_single_with_return.<locals>.wrapršr›rr—rÚ_mk_single_with_returnFs
z&AbstractSandbox._mk_single_with_return)ÚreadlinkÚtempnamcsttˆƒ‰‡‡fdd„}|S)Ncs ˆ||Ž}|jr| ˆ|¡S|Sr)rŒr³)r@r{r–Úretvalr—rrr™Xs
 z'AbstractSandbox._mk_query.<locals>.wrapršr›rr—rÚ    _mk_queryUs
zAbstractSandbox._mk_query)r+ÚtmpnamcCs|S)z=Called to remap or validate any path, whether input or outputr)r@r!rrrÚ_validate_pathdszAbstractSandbox._validate_pathcOs
| |¡S©zCalled for path inputs©rº©r@Ú    operationr!r{r–rrrr hszAbstractSandbox._remap_inputcCs
| |¡S)zCalled for path outputsr¼)r@r¾r!rrrr³lszAbstractSandbox._remap_outputcOs0|j|d|f|ž|Ž|j|d|f|ž|ŽfS)ú?Called for path pairs like rename, link, and symlink operationsz-fromz-to)r ©r@r¾r”r•r{r–rrrr“psþzAbstractSandbox._remap_pair)N)r9r:r;r<rŒrrrˆrArFr’rœr€rrƒrr¢r‰r‹r´r¸rºr r³r“rrrrrs<
 
 
 
 
 
 
 
 
Údevnullc@s˜eZdZdZe dddddddd    d
d d d dg ¡ZdgZefdd„Z    dd„Z
e rXd'dd„Z d(dd„Z dd„Z dd„Zdd„Zdd „Zd!d"„Zd)d$d%„Zd&S)*r    z<Restrict operations to a single subdirectory - pseudo-chrootrr¥r¦r§r¨r©rªr«r¬r­r°r±r¶z.*lib2to3.*\.pickle$cCsFtj tj |¡¡|_tj |jd¡|_dd„|Dƒ|_t     |¡dS)NÚcSs g|]}tj tj |¡¡‘qSr)r%r!ÚnormcaseÚrealpath)rMr!rrrrsÿz-DirectorySandbox.__init__.<locals>.<listcomp>)
r%r!rÃrÄÚ_sandboxr]Ú_prefixÚ _exceptionsrrr)r@ZsandboxÚ
exceptionsrrrrrŒs þzDirectorySandbox.__init__cOsddlm}||||ƒ‚dS)Nr)r
)r3r
)r@r¾r{r–r
rrrÚ
_violation•s zDirectorySandbox._violationÚrcOs:|dkr(| |¡s(|jd||f|ž|Žt||f|ž|ŽS)N©rÊÚrtr ZrUÚUrŠ)Ú_okrÉr‰©r@r!rr{r–rrrr‰›szDirectorySandbox._filecOs:|dkr(| |¡s(|jd||f|ž|Žt||f|ž|ŽS)NrËr)rÎrÉr‹rÏrrrr‹ szDirectorySandbox._opencCs| d¡dS)Nr¹)rÉr?rrrr¹¥szDirectorySandbox.tmpnamcCsR|j}z>d|_tj tj |¡¡}| |¡p@||jkp@| |j¡W¢S||_XdSr)    rŒr%r!rÃrÄÚ    _exemptedrÅrLrÆ)r@r!ÚactiverÄrrrrΨs
ÿ
ýzDirectorySandbox._okcs<‡fdd„|jDƒ}‡fdd„|jDƒ}t ||¡}t|ƒS)Nc3s|]}ˆ |¡VqdSrrK)rMÚ    exception©ÚfilepathrrrO¶sÿz-DirectorySandbox._exempted.<locals>.<genexpr>c3s|]}t |ˆ¡VqdSr)rcre)rMrfrÓrrrOºsÿ)rÇÚ_exception_patternsÚ    itertoolsÚchainÚany)r@rÔZ start_matchesZpattern_matchesÚ
candidatesrrÓrrеs
þ
þ zDirectorySandbox._exemptedcOs4||jkr0| |¡s0|j|tj |¡f|ž|Ž|Sr»)Ú    write_opsrÎrÉr%r!rÄr½rrrr ÁszDirectorySandbox._remap_inputcOs2| |¡r| |¡s*|j|||f|ž|Ž||fS)r¿)rÎrÉrÀrrrr“ÇszDirectorySandbox._remap_pairéÿcOs@|t@r*| |¡s*|jd|||f|ž|Žtj|||f|ž|ŽS)zCalled for low-level os.open()zos.open)Ú WRITE_FLAGSrÎrÉrƒr)r@rŠÚflagsrr{r–rrrrÍszDirectorySandbox.openN)rÊ)rÊ)rÛ)r9r:r;r<ryÚfromkeysrÚrÕÚ _EXCEPTIONSrrrÉr‰r‹r¹rÎrÐr r“rrrrrr    ~s:þþ     
 
  cCsg|]}tt|dƒ‘qS)rrš)rMÚarrrrÕsrz4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYc@s&eZdZdZe d¡ ¡Zdd„ZdS)r
zEA setup script attempted to modify the filesystem outside the sandboxa
        SandboxViolation: {cmd}{args!r} {kwargs}
 
        The package setup script has attempted to modify files on your system
        that are not within the EasyInstall build area, and has been aborted.
 
        This package cannot be safely installed by EasyInstall, and may not
        support alternate installation locations even if you run its setup
        script by hand.  Please inform the package's author and the EasyInstall
        maintainers to find out if a fix or workaround is available.
        cCs|j\}}}|jjftƒŽSr)r{ÚtmplÚformatr)r@Úcmdr{ÚkwargsrrrÚ__str__ês zSandboxViolation.__str__N)    r9r:r;r<ÚtextwrapÚdedentÚlstriprárårrrrr
Ûs )N)N)<r%rr'ÚoperatorÚ    functoolsrÖrcÚ
contextlibr0ræZsetuptools.externrZsetuptools.extern.six.movesrrrWÚdistutils.errorsrrÚplatformrLZ$org.python.modules.posix.PosixModuleÚpythonrPÚposixZ PosixModulerƒr€rŠr‰Ú    NameErrorrr‹Ú__all__rÚcontextmanagerr r#r*r.r2r/r>rUrSrZrbrgr^r rrrÁrßr    ÚreduceÚor_ÚsplitrÜr
rrrrÚ<module>sx      
ÿ
 
 
 
 
    
 
 
 w 
Vþÿ