%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/setuptools/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/setuptools/__pycache__/archive_util.cpython-312.pyc

�


_�d����dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
gd�ZGd�de�Zd	�Z
e
dfd
�Ze
fd�Ze
fd�Ze
fd
�Zd�Zd�Ze
fd�ZeeefZy)z/Utilities for extracting common archive formats�N)�DistutilsError�)�ensure_directory)�unpack_archive�unpack_zipfile�unpack_tarfile�default_filter�UnrecognizedFormat�extraction_drivers�unpack_directoryc��eZdZdZy)r
z#Couldn't recognize the archive typeN)�__name__�
__module__�__qualname__�__doc__���9/usr/lib/python3/dist-packages/setuptools/archive_util.pyr
r
s��-rr
c��|S)z@The default progress/filter callback; returns True for all filesr)�src�dsts  rr	r	s���Jrc�r�|xstD]}	||||�ytd|z��#t$rY�*wxYw)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)rr
)�filename�extract_dir�progress_filter�drivers�drivers     rrr!sX��*�/�/�Q��	��8�[�/�:�
�
Q�!�!D�x�!O�P�P��"�	��	�s�
*�	6�6c�p�tjj|�std|z��|d|fi}tj|�D]�\}}}||\}}|D]K}	||	zdztjj||	�f|tjj||	�<�M|D]�}
tjj||
�}|||
z|�}|s�2t
|�tjj||
�}
tj|
|�tj|
|�����y)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�targets            rrrAs��
�7�7�=�=��"� �!8�8�!C�D�D�	�2�{�#�
�E� �W�W�X�.�
'���d�E���;���S��	O�A�+.��7�S�=�"�'�'�,�,�s�A�:N�+N�E�"�'�'�,�,�t�Q�'�(�	O��		'�A��W�W�\�\�#�q�)�F�$�S�1�W�f�5�F����V�$������T�1�%�A��O�O�A�v�&��O�O�A�v�&�		'�	
'rc��tj|�st|�d���tj|�5}t	|||�ddd�y#1swYyxYw)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 is not a zip fileN)�zipfile�
is_zipfiler
�ZipFile�_unpack_zipfile_obj)rrr�zs    rrr\sO�����h�'� �8�!E�F�F�	����	"�=�a��A�{�O�<�=�=�=�s�A�Ac�D�|j�D�]}|j}|jd�sd|jd�vr�5t	j
j|g|jd����}|||�}|s�p|jd�rt|�nLt|�|j|j�}t|d�5}|j|�ddd�|jdz	}|s��t	j||���y#1swY�5xYw)z�Internal/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_objrr�info�namer/�datar.�unix_attributess	         rr4r4ks���
�$�$�&�.���}�}���?�?�3��4�4�:�:�c�?�#:�������k�<�D�J�J�s�O�<�� ��v�.�����=�=����V�$�
�V�$��#�#�D�M�M�2�D��f�d�#�
�q�����
�
��,�,��2����H�H�V�_�-�-.�$
�
�s�D�D	c���|��|j�s|j�r�|j}|j�rJtj|j
�}tj||�}tj|�}|j|�}|�"|j�r��|j�r��|duxr"|j�xs|j�}|r|Std��)z;Resolve any links and extract link targets as normal files.NzGot unknown file type)�islnk�issym�linkname�	posixpath�dirnamerEr%�normpath�
_getmember�isfiler#�LookupError)�tar_obj�tar_member_obj�linkpathr*�is_file_or_dirs     r�_resolve_tar_file_or_dirrV�s���
�
$�����.�"6�"6�"8�!�*�*�����!��$�$�^�%8�%8�9�D� �~�~�d�H�5�H� �)�)�(�3�H� �+�+�H�5���
$�����.�"6�"6�"8�$�4�/������9�>�#7�#7�#9�����
�-�
.�.rc#��K�d�|_tj|�5|D]�}|j}|j	d�sd|jd�vr�4t
jj|g|jd����}	t||�}|||�}|s�||jtj�r|dd}||f����	ddd�y#t$rY��wxYw#1swYyxYw�w)z1Emit member-destination pairs from a tar archive.c��y)Nr)�argss r�<lambda>z _iter_open_tar.<locals>.<lambda>�s�rr r7N���)
�chown�
contextlib�closingrEr;r<r!r"r%rVrQr=�sep)rRrr�memberrE�
prelim_dst�	final_dsts       r�_iter_open_tarrc�s�����'�G�M�	�	�	�G�	$�$��	$�F��;�;�D����s�#�t�t�z�z�#��'>�������k�D�D�J�J�s�O�D�J�
�1�'�6�B��(��j�9�I����!�!�"�&�&�)�%�c�r�N�	��)�#�#�)	$�$�$���
��
��$�$�sA�C0�A&C$�C�8C$�	C0�	C!�C$� C!�!C$�$C-�)C0c��	tj|�}t	|||�D]\}}	|j||��y#tj$r}t|�d��|�d}~wwxYw#tj$rY�[wxYw)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- is not a compressed or uncompressed tar fileNT)�tarfiler?�TarErrorr
rc�_extract_member�ExtractError)rrr�tarobj�er`rbs       rrr�s�������h�'��,�����
���	�
	��"�"�6�9�5�
���#���� �AI�K�
��	�����#�#�	��	�s(�A�A*�A'�A"�"A'�*B�?B)rr1rer!r&rLr]�distutils.errorsr�_pathr�__all__r
r	rrrr4rVrcrrrrr�<module>rns���5���	�
���+�#���.��.��
;I�RV�Q�@=K�'�6;I�=�CQ�.�</�*$�:;I��:&�~�~�E�r

Zerion Mini Shell 1.0