� ,�Re�����dZddlZddlZddlZddlZddlZddlZddlmZddl m Z gd�Z Gd�de��Z d �Z e dfd �Ze fd �Ze fd �Ze fd �Zd�Zd�Ze fd�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��eZdZdZdS)r z#Couldn't recognize the archive typeN)�__name__� __module__� __qualname__�__doc__����/builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el8.x86_64/opt/alt/python311/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)�src�dsts rr r s�� �Jrc�~�|ptD]"} ||||��dS#t$rY�wxYwtd|z���)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 rrrsy��.�/�/�  �  �� � �F�8�[�/� :� :� :� �F�F��"� � � � �H� ���� !� /�(� :� � � s � � *�*c�|�tj�|��std|z���|d|fi}tj|��D]�\}}}||\}}|D]K} || zdztj�|| ��f|tj�|| ��<�L|D]�} tj�|| ��} ||| z| ��} | s�4t | ��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) �os�path�isdirr �walk�joinr�shutil�copyfile�copystat) rrr�paths�base�dirs�filesrr�d�f�targets rr r @sY�� �7�=�=�� "� "�E� �!8�8�!C�D�D�D� �2�{�#� �E� �W�X�.�.� '� '���d�E���;���S�� O� O�A�+.��7�S�=�"�'�,�,�s�A�:N�:N�+N�E�"�'�,�,�t�Q�'�'� (� (�� '� '�A��W�\�\�#�q�)�)�F�$�_�S�1�W�f�5�5�F�� �� �V� $� $� $��� � �T�1�%�%�A� �O�A�v� &� &� &� �O�A�v� &� &� &� &� '� '� 'rc���tj|��st|�d����tj|��5}t |||��ddd��dS#1swxYwYdS)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[s��� � �h� '� '�G� �8�8�8�!E�F�F�F� ��� "� "�=�a��A�{�O�<�<�<�=�=�=�=�=�=�=�=�=�=�=�=����=�=�=�=�=�=s�A�A�!Ac�j�|���D�]}|j}|�d��sd|�d��vr�7t jj|g|�d���R�}|||��}|s�p|�d��rt|��nft|��|� |j��}t|d��5}|� |��ddd��n #1swxYwY|j dz }|rt j ||����dS)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 rr4r4js�� �$�$�&�&�.�.���}�� �?�?�3� � � �4�4�:�:�c�?�?�#:�#:� ����k�<�D�J�J�s�O�O�<�<�<�� ���v�.�.��� � � �=�=�� � � � �V� $� $� $� $� �V� $� $� $��#�#�D�M�2�2�D��f�d�#�#� �q����� � � � � � � � � � � � � � ���� � � � ��,��2�� � .� �H�V�_� -� -� -��-.�.s�#D�D � D c� �|��|���s|���r�|j}|���rBtj|j��}tj||��}tj|��}|�|��}|�(|�����|�����|duo'|� ��p|� ��}|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�� � $� � � � "� "� %�&4�&:�&:�&<�&<� %�!�*�� � � � !� !� 4��$�^�%8�9�9�D� �~�d�H�5�5�H� �)�(�3�3�H� �+�+�H�5�5�� � $� � � � "� "� %�&4�&:�&:�&<�&<� %� �d�"� <� � � � � � :�N�$8�$8�$:�$:������ �-� .� .�.rc#��K�d�|_tj|��5|D]�}|j}|�d��sd|�d��vr�6t jj|g|�d���R�} t||��}n#t$rY�~wxYw|||��}|s��|� t j ��r |dd�}||fV��� ddd��dS#1swxYwYdS)z1Emit member-destination pairs from a tar archive.c��dS)Nr)�argss r�z _iter_open_tar..�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�O�D�D�D�J� �1�'�6�B�B����� � � ��� ����(���j�9�9�I�� ���!�!�"�&�)�)� +�%�c�r�c�N� ��)�#� #� #� #� #�) $�$�$�$�$�$�$�$�$�$�$�$�$����$�$�$�$�$�$s7�A#C1�B�C1� B!�C1� B!�!AC1�1C5�8C5c� � tj|��}n*#tj$r}t|�d���|�d}~wwxYwt |||��D]1\}} |�||���#tj$rY�.wxYwdS)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�'�'���� � ���� �AI��� K� � �� ��������� ,� �K�������� � � � "� "�6�9� 5� 5� 5� 5���#� � � � �D� ���� �4s"��>�9�>�A/�/B�B)rr1rer!r&rLr]�distutils.errorsr�_pathr�__all__r r rr rr4rVrcrr rrr�rnsn��5�5��������� � � � � � � � ���������+�+�+�+�+�+�#�#�#�#�#�#� � � �� .�.�.�.�.��.�.�.���� 0>��! �! �! �! �H=K�'�'�'�'�6;I� =� =� =� =�CQ�.�.�.�.�</�/�/�*$�$�$�:;I�����6&�~�~�E���r