a0bi$ S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKr\R S 5 r \R SS\ 4S j5 r S r\R \R 4S j5 r \R SS\ 4S j5 r\R S 5 r " S S 5 r " S S\R" \R$ 5 r " S S\R$ 5 rg) Nc # # [ R " 5 n[ R " U 5 U v [ R " U5 g! [ R " U5 f = f7f)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/BUILDROOT/alt-python313-setuptools-69.0.2-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/setuptools/_vendor/jaraco/context.pypushdr s= 99;DHHSM s ,A%A A% A""A%c # # Uc? [ R R U 5 R SS5 R SS5 nUc$ [ R " [ R SS9nO[ R " S[ 5 U" SR " S0 [ 5 D65 S nS nSR XE45 nU" UR " SS[ U 5 0[ 5 D65 U" U5 Uv SSS5 U" S R " S0 [ 5 D65 g! , ( d f N/= f! U" S R " S0 [ 5 D65 f = f7f)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 WW%%c*229bAII&RTU ~"":#8#8E 68JK &&0017"Kjj&*+szzG&7&<GGH : $++5df56 $++5df56s7 B%E(A D0 1D6D0 >!E D-)D0 0"EEc F U SS n[ SSSS9nUR US5 $ )z 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 : s0 Hccc*G;;,c22 c # j # [ R " 5 n Uv U " U5 g! U " U5 f = f7f)a. 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 s/ !Hs 3&