bCm&XNddlZddlZddlZddlZddlZddlZddlZejdZejddefdZ dZ ejej fdZ ejdde fdZ ejdZGd d ZGd d ejejZdS) Nc#Ktj}tj| |Vtj|dS#tj|wxYwN)osgetcwdchdir)dirorigs /builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el9.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/_vendor/jaraco/context.pypushdr sO 9;;DHSMMM  s AAc #K|Gtj|dddd}| t jt jd}|djd it d}d }d ||f}||jd d t|it||5|Vdddn #1swxYwY|d jd itdS#|d jd itwxYw)z Get a tarball, extract it, change to that directory, yield, then clean up. `runner` is the function to invoke commands. `pushd` is a context manager for changing the directory. Nz.tar.gzz.tgzT)shellzmkdir {target_dir}zwget {url} -O -z7tar x{compression} --strip-components=1 -C {target_dir}z | compressionzrm -Rf {target_dir}) rpathbasenamereplace functoolspartial subprocess check_callformatvarsjoininfer_compression)url target_dirrunnerr getterextractcmds r tarball_contextr"sW%%c**229bAAII&RTUU  ~":#8EEE  F &  & 0 0 0 01117"Kjj&'*++zszGG&7&<&<GGGHHH U:                       +$+55dff5566666+$+55dff556666s1AD((C9- D(9C==D(C=D(($E cf|dd}tddd}||dS)zF Given a URL or filename, infer the compression code for tar. NzjJ)gzbzxz)dictget)rcompression_indicatormappings r rr0s;  Hccc***G ;;,c 2 22c#pKtj} |V||dS#||wxYw)zk Create a temporary directory context. Pass a custom remover to override the removal behavior. N)tempfilemkdtemp)removertemp_dirs r r4r4;sP !!Hs( 5Tc#Kd|vrdnd}|5}|d||g}|r|d|gttjjd}|r|nd}t j|||VddddS#1swxYwYdS)z Check out the repo indicated by url. If dest_ctx is supplied, it should be a context manager to yield the target directory for the check out. githgclonez--branchwN)stdout)extendopenrrdevnullrr) rbranchquietdest_ctxexerepo_dirr!r=r:s r repo_contextrCHsC<<%%TC xGS(+  - JJ F+ , , ,rw,,!+tc&1111sABBBc#KdVdSrrrr/r nullrE[s EEEEEr/ceZdZdZdZeffdZdZedZ edZ edZ dZ d Z ed d Zd Zd S) ExceptionTrapaG A context manager that will catch certain exceptions and provide an indication they occurred. >>> with ExceptionTrap() as trap: ... raise Exception() >>> bool(trap) True >>> with ExceptionTrap() as trap: ... pass >>> bool(trap) False >>> with ExceptionTrap(ValueError) as trap: ... raise ValueError("1 + 1 is not 3") >>> bool(trap) True >>> with ExceptionTrap(ValueError) as trap: ... raise Exception() Traceback (most recent call last): ... Exception >>> bool(trap) False )NNNc||_dSr) exceptions)selfrIs r __init__zExceptionTrap.__init__s $r/c|SrrrJs r __enter__zExceptionTrap.__enter__s r/c|jdSNrexc_inforMs r typezExceptionTrap.type}Qr/c|jdS)NrQrMs r valuezExceptionTrap.valuerTr/c|jdS)NrQrMs r tbzExceptionTrap.tbrTr/cV|d}|ot||j}|r||_|SrP) issubclassrIrR)rJrRrSmatchess r __exit__zExceptionTrap.__exit__s5{<:dDO<<  %$DMr/c*t|jSr)boolrSrMs r __bool__zExceptionTrap.__bool__sDIr/_testcNtjfd}|S)a Wrap func and replace the result with the truth value of the trap (True if an exception occurred). First, give the decorator an alias to support Python 3.8 Syntax. >>> raises = ExceptionTrap(ValueError).raises Now decorate a function that always fails. >>> @raises ... def fail(): ... raise ValueError('failed') >>> fail() True ctj5}|i|dddn #1swxYwY|Sr)rGrI)argskwargstraprcfuncrJs r wrapperz%ExceptionTrap.raises..wrapperst// &4d%f%%% & & & & & & & & & & & & & & &5;; s +//)rwraps)rJrircrjs``` r raiseszExceptionTrap.raisessF&             r/cD||tjS)a Wrap func and replace the result with the truth value of the trap (True if no exception). First, give the decorator an alias to support Python 3.8 Syntax. >>> passes = ExceptionTrap(ValueError).passes Now decorate a function that always fails. >>> @passes ... def fail(): ... raise ValueError('failed') >>> fail() False rb)rloperatornot_)rJris r passeszExceptionTrap.passess&{{4x}{555r/N)__name__ __module__ __qualname____doc__rR ExceptionrKrNpropertyrSrWrZr^rar`rlrprr/r rGrG`s: H#,,%%%%  X   X   X %)666666r/rGceZdZdZdS)suppressz A version of contextlib.suppress with decorator support. >>> @suppress(KeyError) ... def key_error(): ... {}[''] >>> key_error() N)rqrrrsrtrr/r rxrxsr/rx)rr contextlibrr1shutilrncontextmanagerr r"rrmtreer4rCrErGrxContextDecoratorrr/r r~s    $(U77776333 ]     !$    j6j6j6j6j6j6j6j6Zz"J$?r/