
    vKg                         S r SSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSK	J
r
  / SQr " S S\
5      rS	 r\S4 SS jjr\4SS jjr\4SS jjr\4S jrS rS r\4S
\4S jjr\\\4rg)z/Utilities for extracting common archive formats    N   )ensure_directory)DistutilsError)unpack_archiveunpack_zipfileunpack_tarfiledefault_filterUnrecognizedFormatextraction_driversunpack_directoryc                       \ rS rSrSrSrg)r
      z#Couldn't recognize the archive type N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       W/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/archive_util.pyr
   r
      s    -r   r
   c                     U$ )z@The default progress/filter callback; returns True for all filesr   )srcdsts     r   r	   r	      s    Jr   returnc                     U=(       d    [          H  n U" XU5          g   [        SU -  5      e! [         a     M,  f = f)a]  Unpack `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_dirprogress_filterdriversdrivers        r   r   r   "   sR    . ///	8/:  0 !!Dx!OPP " 		s   	/
==c                    [         R                  R                  U 5      (       d  [        SU -  5      eU SU40n[         R                  " U 5       H  u  pEnX4   u  pxU HI  n	Xy-   S-   [         R                  R                  X5      4U[         R                  R                  XI5      '   MK     U H  n
[         R                  R                  X5      nU" Xz-   U5      nU(       d  M6  [        U5        [         R                  R                  XJ5      n
[        R                  " X5        [        R                  " X5        M     M     g)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)
ospathisdirr
   walkjoinr   shutilcopyfilecopystat)r   r   r   pathsbasedirsfilesr   r   dftargets               r   r   r   D   s    
 77=="" !88!CDD 	2{#E  WWX.E;A+.7S="'',,s:N+NE"'',,t'( AWW\\#)F$SWf5FV$T%AOOA&OOA& 	 /r   c                     [         R                  " U 5      (       d  [        U < S35      e[         R                  " U 5       n[	        X1U5        SSS5        g! , (       d  f       g= f)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)r   r   r   zs       r   r   r   _   sG     h'' 8!EFF		"aAO< 
#	"	"s   A
A%c                    U R                  5        GH  nUR                  nUR                  S5      (       d  SUR                  S5      ;   a  M=  [        R
                  R                  " U/UR                  S5      Q76 nU" XE5      nU(       d  M~  UR                  S5      (       a  [        U5        OL[        U5        U R                  UR                  5      n[        US5       nUR                  U5        SSS5        UR                  S-	  nU(       d  GM  [        R                  " XX5        GM     g! , (       d  f       NC= f)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   
startswithsplitr%   r&   r)   endswithr   readopenwriteexternal_attrchmod)	zipfile_objr   r   infonamer3   datar2   unix_attributess	            r   r8   r8   n   s    
 $$&}} ??344::c?#:k<DJJsO< .==V$ V$##DMM2Dfd#q $,,2?HHV-- '$ $#s   #D22
E 	c                 F   Ub  UR                  5       (       d  UR                  5       (       a  UR                  nUR                  5       (       aL  [        R                  " UR
                  5      n[        R                  " X25      n[        R                  " U5      nU R                  U5      nUb.  UR                  5       (       a  M  UR                  5       (       a  M  USL=(       a'    UR                  5       =(       d    UR                  5       nU(       a  U$ [        S5      e)z;Resolve any links and extract link targets as normal files.NzGot unknown file type)islnkissymlinkname	posixpathdirnamerI   r)   normpath
_getmemberisfiler'   LookupError)tar_objtar_member_objlinkpathr.   is_file_or_dirs        r   _resolve_tar_file_or_dirrZ      s    

$."6"6"8"8!**!!$$^%8%89D ~~d5H ))(3H ++H5 
$."6"6"8"8 $4/ 9>#7#7#9  
-
..r   c              #     #    S U l         [        R                  " U 5         U  H  nUR                  nUR	                  S5      (       d  SUR                  S5      ;   a  M<  [        R                  R                  " U/UR                  S5      Q76 n [        X5      nU" XE5      nU(       d  M  UR                  [        R                  5      (       a  USS nX64v   M     SSS5        g! [         a     M  f = f! , (       d  f       g= f7f)z1Emit member-destination pairs from a tar archive.c                      g )Nr   )argss    r   <lambda> _iter_open_tar.<locals>.<lambda>   s    $r   r$   r;   N)chown
contextlibclosingrI   r?   r@   r%   r&   r)   rZ   rU   rA   sep)rV   r   r   memberrI   
prelim_dst	final_dsts          r   _iter_open_tarrh      s      'GM			G	$F;;Ds##ttzz#'>kDDJJsODJ1'B (9I!!"&&))%crN	##)  
%	$   
%	$sB   D
A/C9C(AC9	D
(
C62C95C66C99
DD
c                     [         R                  " U 5      n[	        UUU5       H  u  pV UR                  XV5        M     g! [         R                   a  n[        U < S35      UeSnAff = f! [         R                   a     M_  f = f)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)tarfilerC   TarErrorr
   rh   _extract_memberExtractError)r   r   r   tarobjere   rg   s          r   r   r      s    h' ,
	""65 #   AIK
	 ## 		s(   A A-A*A%%A*-BB)r   N)r   rb   r%   rP   r*   rj   r5   _pathr   distutils.errorsr   __all__r
   r	   r   r   r   r8   rZ   rh   boolr   r   r   r   r   <module>rt      s    5  	     # +. . ,:4Q	QD =K '6 ;I = CQ .</*$: ;I T : &~~E r   