HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-87-generic #88-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 09:28:41 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_internal/utils/__pycache__/unpacking.cpython-312.pyc
�

��hu"�	�
�dZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlmZddlm
Z
ddlmZmZmZmZddlmZej*e�ZeezZ	ddlZeez
Z	ddlZeez
Zd
efd�Zded
e	efd
�Z deed
e!fd�Z"deded
e!fd�Z#ded
dfd�Z$ded
e!fd�Z%ddedede!d
dfd�Z&deded
dfd�Z'	ddedede
ed
dfd�Z(y#e$rej7d�Y��wxYw#e$rej7d	�Y��wxYw)zUtilities related archives.
�N)�Iterable�List�Optional)�ZipInfo)�InstallationError)�BZ2_EXTENSIONS�TAR_EXTENSIONS�
XZ_EXTENSIONS�ZIP_EXTENSIONS)�
ensure_dirzbz2 module is not availablezlzma module is not available�returnc�Z�tjd�}tj|�|S)zBGet the current umask which involves having to set it temporarily.r)�os�umask)�masks �?/usr/lib/python3/dist-packages/pip/_internal/utils/unpacking.py�
current_umaskr+s��
�8�8�A�;�D��H�H�T�N��K��pathc��|jd�jd�}d|vr=d|vr#|jd�|jd�ksd|vr|jdd�Sd|vr|jdd�S|dgS)N�/�\��)�lstrip�find�split�rs r�split_leading_dirr2sz���;�;�s��"�"�4�(�D�
�d�{�	
���$�)�)�C�.�4�9�9�T�?�:�t�4�?O��z�z�#�q�!�!�	
����z�z�$��"�"��b�z�r�pathsc�R�d}|D] }t|�\}}|sy|�|}�||k7s� yy)zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r)r �
common_prefixr�prefix�rests     r�has_leading_dirr%>sG���M����(��.������
�
"�"�M�
�}�
$���r�	directory�targetc���tjj|�}tjj|�}tjj||g�}||k(S)zL
    Return true if the absolute path of target is within the directory
    )rr�abspath�commonprefix)r&r'�
abs_directory�
abs_targetr#s     r�is_within_directoryr-MsL���G�G�O�O�I�.�M�������(�J�
�W�W�
!�
!�=�*�"=�
>�F��]�"�"rc�N�tj|dt�zdz�y)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    i��IN)r�chmodrrs r�2set_extracted_file_to_default_mode_plus_executabler1Xs!��
�H�H�T�E�]�_�,�,�u�4�6r�infoc�r�|jdz	}t|xrtj|�xr|dz�S)N�r/)�
external_attr�bool�stat�S_ISREG)r2�modes  r�zip_item_is_executabler:`s6������#�D���<����d�+�<��u��=�=r�filename�location�flattenc���t|�t|d�}	tj|d��}t	|j��xr|}|j
�D�](}|j}|}|rt|�d}tjj||�}tjj|�}	t||�sd}
t|
j|||���|j!d�s|j!d�rt|���t|	�|j|�}	t|d�5}t#j$||�d	d	d	�|j'�t)|�s��t+|���+	|j'�y	#1swY�FxYw#|j'�t)|�rt+|�wwxYw#|j'�wxYw)
a�
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    �rbT)�
allowZip64rzQThe zip file ({}) has a file ({}) trying to install outside target directory ({})rr�wbN)r�open�zipfile�ZipFiler%�namelist�infolistr;rrr�join�dirnamer-r�format�endswith�shutil�copyfileobj�closer:r1)
r;r<r=�zipfp�zip�leadingr2�name�fn�dir�message�fp�destfps
             r�
unzip_filerWgs����x����4� �E� ��o�o�e��5��!�#�,�,�.�1�=�g���L�L�N�	O�D��=�=�D��B��&�t�,�Q�/�������h��+�B��'�'�/�/�"�%�C�&�x��4�4��(����x��X�(N�O�O��{�{�3��2�;�;�t�#4��2���3���X�X�d�^��O��b�$��7�6��*�*�2�v�6�7��H�H�J�-�d�3�J�2�N�7	O�:	���
�7�7���H�H�J�-�d�3�J�2�N�4��	���
�sB�DG�3F'�?F�F'�G�;G�F$	� F'�')G�G�G%c�b�t|�|j�jd�s|j�jd�rd}n�|j�jt�rd}n`|j�jt�rd}n:|j�jd�rd}nt
j
d|�d	}tj||d
��}	t|j�D�cgc]}|j��c}�}|j�D�]P}|j}|rt|�d}tjj||�}t!||�sd
}t#|j%|||���|j'�rt|���|j)�r	|j+||���	|j/|�}
ttjj5|��|
�J�t|d�5}t7j8|
|�ddd�|
j;�|j=||�|j>dzs��FtA|���S	|j;�ycc}w#t,$r-}	t
j
d||j|	�Yd}	~	���d}	~	wwxYw#t0t2f$r-}	t
j
d||j|	�Yd}	~	���d}	~	wwxYw#1swY��xYw#|j;�wxYw)a�
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    z.gzz.tgzzr:gzzr:bz2zr:xzz.tar�rz-Cannot determine compression type for file %szr:*zutf-8)�encodingrzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNrAr/)!r�lowerrJrr
�logger�warning�tarfilerBr%�
getmembersrQrrrrGr-rrI�isdir�issym�_extract_member�	Exception�extractfile�KeyError�AttributeErrorrHrKrLrM�utimer9r1)r;r<r9�tar�memberrPrRrrT�excrUrVs            r�
untar_filerk�s����x���~�~�� � ��'�8�>�>�+;�+D�+D�V�+L���	���	�	"�	"�>�	2���	���	�	"�	"�=�	1���	���	�	"�	"�6�	*������;��	
���
�,�,�x���
8�C�4�!�S�^�^�=M�"N�6�6�;�;�"N�O���n�n�&�0	M�F����B��&�r�*�1�-���7�7�<�<��"�-�D�&�x��6�4��(����x��x�(P�Q�Q��|�|�~��4� �������'�'���5������0�B��2�7�7�?�?�4�0�1��~�%�~��$��%�3���&�&�r�6�2�3����
��	�	�&�$�'��;�;��&�F�t�L�a0	M�d	�	�	���g#O��"!�	��N�N�I� �����	���	��!�.�1�	��N�N�I� �����	���	��3�3��	�	�	��s��,L�J�B-L�J�L�K�)8L�!L�89L�3L�L�	K�!"K	�L�	K�L�L
� "L�L�L
�
L�L	�L�L.�content_typec���tjj|�}|dk(s8|j�j	t
�st
j|�rt|||j	d���y|dk(sFtj|�s1|j�j	ttztz�r
t||�ytj!d|||�t#d|����)Nzapplication/zipz.whl)r=zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )rr�realpathr[rJrrC�
is_zipfilerWr^�
is_tarfiler	rr
rkr\�criticalr)r;r<rls   r�unpack_filerr�s���
�w�w����)�H��)�)��>�>��$�$�^�4����h�'��8�X�8�3D�3D�V�3L�/L�M��,�,����h�'��>�>��$�$�^�n�%D�}�%T�U��8�X�&�	���
+����	
� �"E�h�Z� P�Q�Qr)T)N))�__doc__�loggingrrKr7r^rC�typingrrrr�pip._internal.exceptionsr�pip._internal.utils.filetypesrr	r
r�pip._internal.utils.miscr�	getLogger�__name__r\�SUPPORTED_EXTENSIONS�bz2�ImportError�debug�lzma�intr�strrr6r%r-r1r:rWrkrr�rr�<module>r�s�����	�
����+�+��6���0�	��	�	�8�	$��&��6��0���N�*��1���M�)��
�s��	�C�	�D��I�	��8�C�=��T��#�3�#��#��#�7�S�7�T�7�>��>�T�>�+��+��+�d�+�d�+�\M��M��M��M�f#'�R��R��R��3�-�R�
�	R��M�0�
�L�L�.�/�0���1�
�L�L�/�0�1�s$�	C
�%	C)�
C&�%C&�)D�D