~f9 ddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddl mZej"j%drddlmcmcmcmZnej*ej2Z eZeZgdZd dZ e jBd dZ"e jBd Z#e jBd Z$e jBd Z%Gd d e&Z'GddZ(e jBdZ)dZ*e jBdZ+e jBdZ,hdZ-dZ.dZ/dZ0GddZ1e2edrejfgZ4ngZ4Gdde1Z5ejlejndjqDcgc] }e9e|dc}Z:GddeZ;y#e$rdZY3wxYwcc}w)!) annotationsN)DistutilsError) working_setjava)AbstractSandboxDirectorySandboxSandboxViolation run_setupcd}t||5}|j}ddd||}t|d}t|||y#1swY(xYw)z. Python 3 implementation of execfile. rbNexec)openreadcompiler )filenameglobalslocalsmodestreamscriptcodes [/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/setuptools/sandbox.py _execfiler&sY D h  ~ 68V ,Dw s AAc#Ktjdd}||tjdd ||tjddy#|tjddwxYwwN)sysargv)replsaveds r save_argvr 3sJ HHQKE    e s)AAAAAc#Ktjdd} ||tjddy#|tjddwxYwwr)rpathrs r save_pathr$>s7 HHQKE  e sA/AAAc#Ktj|dtj}|t_ d|t_y#|t_wxYww)zL Monkey-patch tempfile.tempdir with replacement, ensuring it exists T)exist_okN)osmakedirstempfiletempdir) replacementrs r override_tempr,GsA KK d+   E"H!  5s3AA A AAc#Ktj}tj| |tj|y#tj|wxYwwr)r'getcwdchdir)targetrs rpushdr1Xs= IIKEHHV  s*A!AA!AA!c eZdZdZedZy)UnpickleableExceptionzP An exception representing another Exception that could not be pickled. c  tj|tj|fS#t$r*ddlm}|j ||t |cYSwxYw)z Always return a dumped (pickled) type and exc. If exc can't be pickled, wrap it in UnpickleableException first. r)r3)pickledumps Exceptionsetuptools.sandboxr3dumprepr)typeexcclss rr9zUnpickleableException.dumpgsO  1<<%v||C'88 8 1 G88CT#Y0 0  1s),0AAN)__name__ __module__ __qualname____doc__ staticmethodr9rr3r3bs 1 1rDr3c"eZdZdZdZdZdZy)ExceptionSaverz] A Context Manager that will save an exception, serialize, and restore it later. c|SrrCselfs r __enter__zExceptionSaver.__enter__|s rDcN|sytj|||_||_y)NFT)r3r9_saved_tb)rIr;r<tbs r__exit__zExceptionSaver.__exit__s*,00s; rDcdt|vryttj|j\}}|j |j )z"restore and re-raise any exceptionrLN)varsmapr5loadsrLwith_tracebackrM)rIr;r<s rresumezExceptionSaver.resumes@ 4: %  dkk2 c  **rDN)r>r?r@rArJrOrUrCrDrrFrFvs  +rDrFc#6Ktjjt5}dddtjj fdtjD}t |j y#1swY]xYww)z Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. Nc3LK|]}|vr|jds|yw)z encodings.N startswith).0mod_namers r zsave_modules..s/  5 ##L1 s!$)rmodulescopyrFupdate_clear_modulesrU) saved_exc del_modulesrs @r save_modulesrcsy KK   E  Y KKu K; s)BB AB BBcFt|D]}tj|=yr)listrr]) module_namesr[s rr`r`s& KK !'rDc#Ktj} |tj|y#tj|wxYwwr) pkg_resources __getstate__ __setstate__r#s rsave_pkg_resources_staterks:  & & (E* ""5) ""5)sA 2A A  A c #Ktjj|d}t5t 5t 5t t5t|5t|5tddddddddddddddddddddy#1swY2xYw#1swY6xYw#1swY:xYw#1swY>xYw#1swYBxYw#1swYyxYww)Ntemp setuptools) r'r"joinrkrcr$hide_setuptoolsr r,r1 __import__) setup_dirtemp_dirs r setup_contextrtsww||Iv.H ! # " ^ " "!["&x0""9-"&|4!""" " " " " """""" " " " " " "s+C9 C- C!C C $ B= 0B1 B= C CC! C-( C91B:6B= =CC C CC C!!C* &C--C62C9>Cython distutilsrnrh_distutils_hackc<|jddd}|tvS)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 .r)split_MODULES_TO_HIDE)r[ base_modules r _needs_hidingr~s%"..a(+K * **rDctjjdd}||jt t tj}t |y)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. rwN)rr]get _remove_shimfilterr~r`)rwr]s rrprpsCkkoo&7>O"$$&]CKK0G7rDc|tjjtjj|}t |5 |gt |zt jddt jjd|tjtjjdt|5t|d}t||ddddddy#1swYxYw#t $r&}|j"r|j"drYd}~?d}~wwxYw#1swYyxYw)z8Run a distutils setup script, sandboxed in its directoryNrc"|jSr)activate)dists rzrun_setup..s dmmorD__main__)__file__r>)r'r"abspathdirnamertrerrinsertr__init__ callbacksappendrdictr SystemExitargs) setup_scriptrrrnsvs rr r s =>I y !  '.4:5CHHQK HHOOAy )  "  ! ! ( ()E F!), ,<*E,+ ,   , , vv!&&)   sID2 A?D C4#D4C= 9D D/ D*%D2*D//D22D;ceZdZdZdZdZdZdZdZdZ ddZ d D]Z e e e s e e ee <ddd Zer ed eZed eZdD]Z e e e s ee ee <ddZdD]Z e e e s ee ee <ddZdD]Z e e e s ee ee <dZdZdZdZy )rzDWrap 'os' module and 'open()' builtin for virtualizing setup scriptsFcttDcgc]!}|jdst||r|#c}|_ycc}w)N_)dir_osrYhasattr_attrs)rInames rrzAbstractSandbox.__init__s<C ??3'GD$,?    s&Ac \|jD]}tt|t||yr)rsetattrr'getattr)rIsourcers r_copyzAbstractSandbox._copys#KKD Bgfd3 4 rDc|j|tr|jt_|jt_d|_y)NT)r_filebuiltinsfile_openr_activerHs rrJzAbstractSandbox.__enter__s. 4  JJHM   rDcd|_trtt_tt_|j tyNF)rrrrrrrr)rIexc_type exc_value tracebacks rrOzAbstractSandbox.__exit__#s% !HM  3rDc@|5|cdddS#1swYyxYw)zRun 'func' under os sandboxingNrC)rIfuncs rrunzAbstractSandbox.run*s  6   sc6ttfd}|S)Ncl|jr|j||g|i|\}}||g|i|Sr)r _remap_pair)rIsrcdstrkwroriginals rwrapz3AbstractSandbox._mk_dual_path_wrapper..wrap2sE||+4++D#sHTHRHSC2t2r2 2rDrrrrrs` @r_mk_dual_path_wrapperz%AbstractSandbox._mk_dual_path_wrapper/s3% 3  rD)renamelinksymlinkNc>xsttfd}|S)Ncb|jr|j|g|i|}|g|i|Sr)r _remap_inputrIr"rrrrs rrz5AbstractSandbox._mk_single_path_wrapper..wrap@s=||(t((tAdAbAD.4.2. .rDr)rrrs`` r_mk_single_path_wrapperz'AbstractSandbox._mk_single_path_wrapper=s 1wsD1 /  rDrr)statlistdirr/rchmodchownmkdirremoveunlinkrmdirutimelchownchrootlstat startfilemkfifomknodpathconfaccessc6ttfd}|S)Nc|jr3|j|g|i|}|j|g|i|S|g|i|Sr)rr _remap_outputrs rrz4AbstractSandbox._mk_single_with_return..wrapes_||(t((tAdAbA))$0K0K0KLLD.4.2. .rDrrs` @r_mk_single_with_returnz&AbstractSandbox._mk_single_with_returnbs3% /  rD)readlinktempnamc6ttfd}|S)NcT|i|}|jr|j|S|Sr)rr)rIrrretvalrrs rrz'AbstractSandbox._mk_query..wrapts1t*r*F||))$77MrDrrs` @r _mk_queryzAbstractSandbox._mk_queryqs3%   rD)r.tmpnamc|S)z=Called to remap or validate any path, whether input or outputrC)rIr"s r_validate_pathzAbstractSandbox._validate_paths rDc$|j|SzCalled for path inputsrrI operationr"rrs rrzAbstractSandbox._remap_input""4((rDc$|j|S)zCalled for path outputsr)rIrr"s rrzAbstractSandbox._remap_outputrrDcj|j|dz|g|i||j|dz|g|i|fS)?Called for path pairs like rename, link, and symlink operationsz-fromz-to)rrIrrrrrs rrzAbstractSandbox._remap_pairsP D  i'13 D D D D  i%/ Bt Br B  rD)rstrr)r>r?r@rArrrrJrOrr_AbstractSandbox__namerrrrrrrrrrrrrCrDrrr sNG 5 0 3 4VFHV -0 * 3 5f=FHV * ' 3 (0FHV ')) rDrdevnullceZdZUdZej gdZgZded< e fdZ dZ e rddZ ddZ d Zd Zd Zd Zd ZddZy)rz}tjjtjj|@c}|_tj|ycc}w)N) r'r"normcaserealpath_sandboxro_prefix _exceptionsrr)rIsandbox exceptionsr"s rrzDirectorySandbox.__init__s(()9)9')BC ww||DMM26 AK 9=BGG  RWW--d3 4    & s5ACc"ddlm}||||)Nr)r )r8r )rIrrrr s r _violationzDirectorySandbox._violations7y$33rDc||dvr)|j|s|jd||g|i|t||g|i|S)Nrrtr rUUr)_okrrrIr"rrrs rrzDirectorySandbox._filesH77d@T@R@t1d1b1 1rDc||dvr)|j|s|jd||g|i|t||g|i|S)Nrr)rrrrs rrzDirectorySandbox._opensH 3 3DHHTN DOOFD$ < < <T4-$-"--rDc&|jdy)Nr)rrHs rrzDirectorySandbox.tmpnams !rDcH|j} d|_tjjtjj |}|j |xs,||j k(xs|j|j ||_S#||_wxYwr) rr'r"rr _exemptedrrYr)rIr"activers rrzDirectorySandbox._oks " DLww''(8(8(>?Hx(5t}},5&&t||4  "DL6DLs BB B!cfd|jD}fd|jD}tj||}t |S)Nc3@K|]}j|ywrrX)rZ exceptionfilepaths rr\z-DirectorySandbox._exempted..s! /8H   * sc3JK|]}tj|ywr)rematch)rZpatternr s rr\z-DirectorySandbox._exempted..s! ,3BHHWh ' s #)rr itertoolschainany)rIr  start_matchespattern_matches candidatess ` rrzDirectorySandbox._exemptedsI <@r?r@rArfromkeysrr__annotations__ _EXCEPTIONSrrrrrrrrrrrCrDrrrscF I 35/44+6'4   2 . " "  8rDrz4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYcVeZdZdZej dj ZdZy)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. cj|j\}}}|jjditS)NrC)rtmplformatr)rIcmdrkwargss r__str__zSandboxViolation.__str__s. IIT6tyy+&(++rDN) r>r?r@rAtextwrapdedentlstripr"r&rCrDrr r s+O 8??   fh ,rDr r)< __future__rr'rr)operator functoolsrr contextlibr5r'rrhdistutils.errorsrrplatformrY$org.python.modules.posix.PosixModulepythonr]posix PosixModulerrrr NameErrorrr__all__rcontextmanagerr r$r,r1r7r3rFrcr`rkrtr|r~rpr rrrrrreduceor_r{rrr )as0rr:s"   +%<<6"66 ++bgg C E        ! !  1I1(++< 2"  **  " "+* (E E P 2y::,KKY8Y8xi LLHMMO  Q ,~,M E~sF3G 3F>=F>