E.\ | d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZej d Z ej dde fd Z d Zej ej fd Z ej dde fd Zej d Z G d d Z G d dej ej Z G d dej ZdS ) Nc # K t j }t j | | V t j | dS # t j | w xY w)z >>> tmp_path = getfixture('tmp_path') >>> with pushd(tmp_path): ... assert os.getcwd() == os.fspath(tmp_path) >>> assert os.getcwd() != os.fspath(tmp_path) N)osgetcwdchdir)dirorigs /builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/_vendor/jaraco/context.pypushdr sQ 9;;DHSMMM s A Ac # K |Gt j | dd dd }|!t j t j d }nt j dt | dj di t d }d }d ||f } | |j ddt | it || 5 |V ddd n# 1 swxY w Y | d j di t dS # | d j di t w xY w)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.gz z.tgzT)shellzrunner parameter is deprecatedzmkdir {target_dir}zwget {url} -O -z7tar x{compression} --strip-components=1 -C {target_dir}z | compressionzrm -Rf {target_dir} )r pathbasenamereplace functoolspartial subprocess check_callwarningswarnDeprecationWarningformatvarsjoininfer_compression)url target_dirrunnerr getterextractcmds r tarball_contextr$ s W%%c**229bAAII&RTUU ~":#8EEE 68JKKK F&&00001117"Kjj&'*++zszGG&7&<&<GGGHHH U: +$+55dff5566666+$+55dff556666s1 ,AE DE DE DE $E'c f | dd }t ddd }| |d S )a Given a URL or filename, infer the compression code for tar. >>> infer_compression('http://foo/bar.tar.gz') 'z' >>> infer_compression('http://foo/bar.tgz') 'z' >>> infer_compression('file.bz') 'j' >>> infer_compression('file.xz') 'J' NzjJ)gzbzxz)dictget)r compression_indicatormappings r r r : s; Hccc***G;;,c222 c # p K t j } |V | | dS # | | w xY w)aN Create a temporary directory context. Pass a custom remover to override the removal behavior. >>> import pathlib >>> with temp_dir() as the_dir: ... assert os.path.isdir(the_dir) ... _ = pathlib.Path(the_dir).joinpath('somefile').write_text('contents') >>> assert not os.path.exists(the_dir) N)tempfilemkdtemp)removertemp_dirs r r6 r6 N sP !!Hs ( 5Tc # K d| v rdnd} | 5 }|d| |g}|r| d|g t t j j d }|r|nd}t j || |V ddd dS # 1 swxY w Y dS )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)extendopenr r devnullr r ) r branchquietdest_ctxexerepo_dirr# r? r<