Viewing File: /opt/hc_python/lib/python3.12/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-312.pyc
�
T�*jt � �
� d Z ddlZddlmZ ddlmZ ddlmZmZ ddl m
Z
ddlmZ dZ
ej e� Zd ed
edeeef fd�Zd
ed
edefd�Zd
ededefd�Zd
ededefd�Zdedeedf fd�Zdeedf d
eddfd�Zy)z/Support functions for working with wheel files.� N)�Message)�Parser)�
BadZipFile�ZipFile)�canonicalize_name)�UnsupportedWheel)� r � wheel_zip�name�returnc � � t | |� }t | |� }t |� }t ||� ||fS # t $ r}t |� d|� �� �d}~ww xY w)z�Extract information from the provided wheel, ensuring it meets basic
standards.
Returns the name of the .dist-info directory and the parsed WHEEL metadata.
z has an invalid wheel, N)�wheel_dist_info_dir�wheel_metadata�
wheel_versionr �check_compatibility)r
r �info_dir�metadata�version�es �H/opt/hc_python/lib/python3.12/site-packages/pip/_internal/utils/wheel.py�parse_wheelr sl � �D�&�y�$�7��!�)�X�6����)�� ���&��X���� � D��$��'>�q�c�B�C�C��D�s �#5 � A�A�A�sourcec � � | j � D �ch c] }|j dd� d �� }}|D �cg c] }|j d� s�|�� }}|st d� �t |� dkD r)t dj dj
|� � � �|d }t |� }t |� }|j |� st d|�d |��� �|S c c}w c c}w )
z�Returns the name of the contained .dist-info directory.
Raises AssertionError or UnsupportedWheel if not found, >1 found, or
it doesn't match the provided name.
�/r r z
.dist-infoz.dist-info directory not foundz)multiple .dist-info directories found: {}z, z.dist-info directory z does not start with ) �namelist�split�endswithr �len�format�joinr �
startswith) r r �p�subdirs�s� info_dirsr �
info_dir_name�canonical_names r r r $ s� � � ,2�?�?�+<�=�+<�a�q�w�w�s�A��q�!�+<�G�=�#�@�G�q�q�z�z�,�'?��G�I�@���?�@�@�
�9�~����7�>�>�t�y�y��?S�T�
�
� ��|�H�%�h�/�M�&�t�,�N��#�#�N�3��#�H�<�/D�^�DV�W�
�
� �O��+ >��@s �C�C�C�pathc � � | j |� S # t t t f$ r}t d|�d|��� �d }~ww xY w)Nzcould not read z file: )�readr �KeyError�RuntimeErrorr )r r( r s r �read_wheel_metadata_filer- C sJ � �G��{�{�4� � ��
��,�/� G�������u�E�F�F��G�s � �=�8�=�
dist_info_dirc � � |� d�}t | |� } |j � }t � j |� S # t $ r}t d|�d|��� �d}~ww xY w)ziReturn the WHEEL metadata of an extracted wheel, if possible.
Otherwise, raise UnsupportedWheel.
z/WHEELzerror decoding z: N)r- �decode�UnicodeDecodeErrorr r �parsestr)r r. r( �wheel_contents�
wheel_textr s r r r L sq � � �_�F�#�D�-�f�d�;�N�B�#�*�*�,�
� �8���Z�(�(��
� B������1�%�@�A�A��B�s �<