efdZddlZddlZddlZddlZddlZddlZddlmZddl m Z gdZ GddeZ d Z e dfd Ze fd Ze fd Ze fd ZdZdZe fdZeeefZdS)z/Utilities for extracting common archive formatsN)DistutilsError)ensure_directory)unpack_archiveunpack_zipfileunpack_tarfiledefault_filterUnrecognizedFormatextraction_driversunpack_directoryceZdZdZdS)r z#Couldn't recognize the archive typeN)__name__ __module__ __qualname____doc__w/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/archive_util.pyr r s----rr c|S)z@The default progress/filter callback; returns True for all filesr)srcdsts rr r s Jrc~|ptD]"} ||||dS#t$rYwxYwtd|z)aUnpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat`` `progress_filter` is a function taking two arguments: a source path internal to the archive ('/'-separated), and a filesystem path where it will be extracted. The callback must return the desired extract path (which may be the same as the one passed in), or else ``None`` to skip that file or directory. The callback can thus be used to report on the progress of the extraction, as well as to filter the items extracted or alter their extraction paths. `drivers`, if supplied, must be a non-empty sequence of functions with the same signature as this function (minus the `drivers` argument), that raise ``UnrecognizedFormat`` if they do not support extracting the designated archive type. The `drivers` are tried in sequence until one is found that does not raise an error, or until all are exhausted (in which case ``UnrecognizedFormat`` is raised). If you do not supply a sequence of drivers, the module's ``extraction_drivers`` constant will be used, which means that ``unpack_zipfile`` and ``unpack_tarfile`` will be tried, in that order. Nz!Not a recognized archive type: %s)r r )filename extract_dirprogress_filterdriversdrivers rrr!su*//QQ  F8[/ : : : FF"    H  !!Dx!OPPPs  **c|tj|std|z|d|fi}tj|D]\}}}||\}}|D]K} || zdztj|| f|tj|| <L|D]} tj|| } ||| z| } | s4t | tj|| } tj| | tj | | dS)z "Unpack" a directory, using the same interface as for archives Raises ``UnrecognizedFormat`` if `filename` is not a directory z%s is not a directory/N) ospathisdirr walkjoinrshutilcopyfilecopystat) rrrpathsbasedirsfilesrrdftargets rr r AsY 7== " "E !88!CDDD 2{# E WX.. ' 'dE;S O OA+.7S="',,sA:N:N+NE"',,tQ'' ( ( ' 'AW\\#q))F$_S1Wf55F  V $ $ $ T1%%A OAv & & & OAv & & & & ' ' 'rctj|st|dtj|5}t |||ddddS#1swxYwYdS)zUnpack zip `filename` to `extract_dir` Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined by ``zipfile.is_zipfile()``). See ``unpack_archive()`` for an explanation of the `progress_filter` argument. z is not a zip fileN)zipfile is_zipfiler ZipFile_unpack_zipfile_obj)rrrzs rrr\s  h ' 'G 888!EFFF  " "=aA{O<<<==================sAA!Acj|D]}|j}|dsd|dvr7t jj|g|dR}|||}|sp|drt|nft|| |j}t|d5}| |dddn #1swxYwY|j dz }|rt j ||dS)zInternal/private API used by other parts of setuptools. Similar to ``unpack_zipfile``, but receives an already opened :obj:`zipfile.ZipFile` object instead of a filename. r ..wbN)infolistr startswithsplitr!r"r%endswithrreadopenwrite external_attrchmod) zipfile_objrrinfonamer/datar.unix_attributess rr4r4ks $$&&..} ??3   44::c??#:#: k#7#7#9#9 - . ..rc#Kd|_tj|5|D]}|j}|dsd|dvr6t jj|g|dR} t||}n#t$rY~wxYw|||}|s| t j r |dd}||fV ddddS#1swxYwYdS)z1Emit member-destination pairs from a tar archive.cdS)Nr)argss rz _iter_open_tar..s$rr r7N) chown contextlibclosingrEr;r<r!r"r%rVrQr=sep)rRrrmemberrE prelim_dst final_dsts r_iter_open_tarrcs}'&GM  G $ $$$ $ $F;Ds## ttzz#'>'>kDDJJsOODDDJ 1'6BB    (j99I !!"&)) +%crcN )# # # # #) $$$$$$$$$$$$$$$$$$$s7A#C1BC1 B!C1 B!!AC11C58C5c  tj|}n*#tj$r}t|d|d}~wwxYwt |||D]1\}} |||#tj$rY.wxYwdS)zUnpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` Raises ``UnrecognizedFormat`` if `filename` is not a tarfile (as determined by ``tarfile.open()``). See ``unpack_archive()`` for an explanation of the `progress_filter` argument. z- is not a compressed or uncompressed tar fileNT)tarfiler?TarErrorr rc_extract_member ExtractError)rrrtarobjer`rbs rrrsh''   AI K    ,      " "69 5 5 5 5#    D  4s">9>A//BB)rr1rer!r&rLr]distutils.errorsr_pathr__all__r r rr rr4rVrcrr rrrrnss55 ++++++######   ........ ;IRVQQQQ@=K''''6;I = = = =CQ....<///*$$$:;I:&~~Er