Your IP : 18.119.124.204


Current Path : /opt/alt/python39/lib/python3.9/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib/python3.9/site-packages/setuptools/__pycache__/archive_util.cpython-39.pyc

a

(�Re��@s�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
gd�ZGdd�de�Zdd	�Z
e
dfd
d�Ze
fdd
�Ze
fdd�Zdd�Zdd�Ze
fdd�ZeeefZdS)z/Utilities for extracting common archive formats�N)�DistutilsError)�ensure_directory)�unpack_archive�unpack_zipfile�unpack_tarfile�default_filter�UnrecognizedFormat�extraction_drivers�unpack_directoryc@seZdZdZdS)rz#Couldn't recognize the archive typeN)�__name__�
__module__�__qualname__�__doc__�rr��/builddir/build/BUILDROOT/alt-python39-setuptools-58.3.0-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/setuptools/archive_util.pyrsrcCs|S)z@The default progress/filter callback; returns True for all filesr)�src�dstrrrrsrc	CsL|ptD]2}z||||�Wnty2YqYq0dSqtd|��dS)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_filterZdriversZdriverrrrrs
�rcCs�tj�|�std|��|d|fi}t�|�D]�\}}}||\}}|D],}	||	dtj�||	�f|tj�||	�<qH|D]T}
tj�||
�}|||
|�}|s�qzt|�tj�||
�}
t�|
|�t�	|
|�qzq.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)
�os�path�isdirr�walk�joinr�shutil�copyfile�copystat)rrr�paths�base�dirs�filesrr�d�f�targetrrrr
@s"�*r
c

Cst�|�std|f��t�|���}|��D]�}|j}|�d�s,d|�d�vrPq,tj	j
|g|�d��R�}|||�}|szq,|�d�r�t|�nHt|�|�
|j�}t|d��}|�|�Wd�n1s�0Y|jd?}	|	r,t�||	�q,Wd�n1�s0YdS)z�Unpack 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%s is not a zip filer�..�wbN�)�zipfile�
is_zipfiler�ZipFile�infolistr�
startswith�splitrrr�endswithr�read�open�write�
external_attr�chmod)
rrr�z�info�namer&�datar%Zunix_attributesrrrr[s(



(
rcCs�|durT|��s|��rT|j}|��rHt�|j�}t�||�}t�|�}|�|�}q|duoj|�	�pj|�
�}|rt|Std��dS)z;Resolve any links and extract link targets as normal files.NzGot unknown file type)�islnk�issym�linkname�	posixpath�dirnamer8r�normpath�
_getmember�isfiler�LookupError)�tar_objZtar_member_obj�linkpathr!Zis_file_or_dirrrr�_resolve_tar_file_or_dir�s"��
�rEc
cs�dd�|_t�|���|D]�}|j}|�d�sd|�d�vr>qtjj|g|�d��R�}zt	||�}Wnt
y|YqYn0|||�}|s�q|�tj�r�|dd�}||fVqWd�n1s�0YdS)z1Emit member-destination pairs from a tar archive.cWsdS)Nr)�argsrrr�<lambda>��z _iter_open_tar.<locals>.<lambda>rr'N���)
�chown�
contextlib�closingr8r.r/rrrrErBr0�sep)rCrr�memberr8Z
prelim_dst�	final_dstrrr�_iter_open_tar�s"


rPc
Cs�zt�|�}Wn6tjyD}ztd|f�|�WYd}~n
d}~00t|||�D].\}}z|�||�WqRtjy~YqR0qRdS)z�Unpack 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/%s is not a compressed or uncompressed tar fileNT)�tarfiler2�TarErrorrrP�_extract_member�ExtractError)rrr�tarobj�erNrOrrrr�s ���r)rr*rQrrr=rK�distutils.errorsr�
pkg_resourcesr�__all__rrrr
rrErPrr	rrrr�<module>s(�
$%

?>