� ��^i��z�dZddlZddlmZddlmZddlmZmZddl m Z m Z ddl m Z ddlmZmZdd lmZdd lmZd Zeje��ZGd �d e��Zde dededefd�Zde dedeeeffd�Zde dedefd�Zde dedefd�Zde dedefd�Z dedee!dffd�Z"dee!dfdeddfd�Z#dS)z0Support functions for working with wheel files. �N)�Message)�Parser)�Dict�Tuple)� BadZipFile�ZipFile)�canonicalize_name)�DistInfoDistribution� Distribution)�UnsupportedWheel)� DictMetadata)�rc�T��eZdZdZdeeefdeddf�fd� Zdedef�fd� Z�xZ S) � WheelMetadatazaMetadata provider that maps metadata decoding exceptions to our internal exception type. �metadata� wheel_name�returnNc�X��t���|��||_dS)N)�super�__init__� _wheel_name)�selfrr� __class__s ���/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/wheel.pyrzWheelMetadata.__init__s)��� ������"�"�"�%������namec��� t���|��S#t$r}td|j�d|�����d}~wwxYw)NzError decoding metadata for �: )r� get_metadata�UnicodeDecodeErrorr r)rr�ers �rrzWheelMetadata.get_metadatasg��� ��7�7�'�'��-�-� -��!� � � �"�F�t�/?�F�F�1�F�F��� ����� ���s� $� A �A�A ) �__name__� __module__� __qualname__�__doc__r�str�bytesrr� __classcell__)rs@rrrs����������&��c�5�j�!1�&�s�&�t�&�&�&�&�&�&��������������rr� wheel_zipr�locationrc �� �t||��\� }� fd�|���D��}i}|D]q}|�dd��\}} t||��||<�0#t$r5}t d�|t |�������d}~wwxYwt||��} t|| |���S)zaGet a pkg_resources distribution given a wheel. :raises UnsupportedWheel: on any errors c�D��g|]}|���d����|��S)�/)� startswith)�.0�p�info_dirs �r� z8pkg_resources_distribution_for_wheel..2s0���V�V�V�A�����n�n�n�9U�9U�V�a�V�V�Vrr-r�{} has an invalid wheel, {}N)r*r� project_name) � parse_wheel�namelist�split�read_wheel_metadata_filer �formatr&rr ) r)rr*�_�metadata_files� metadata_text�path� metadata_namer!rr1s @r�$pkg_resources_distribution_for_wheelr?)s�����i��.�.�K�H�a�V�V�V�V��!3�!3�!5�!5�V�V�V�N�&(�M��W�W���:�:�c�1�-�-���=� W�+C�I�t�+T�+T�M�-� (� (��� W� W� W�"�#@�#G�#G��c�RS�f�f�#U�#U�V�V� V����� W�����]�H�5�5�H� ��H�SW� X� X� X�Xs�A)�) B(�30B#�#B(c �� t||��}t||��}t|��}nB#t$r5}td�|t |�������d}~wwxYwt ||��||fS)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. r3N)�wheel_dist_info_dir�wheel_metadata� wheel_versionr r9r&�check_compatibility)r)rr1r�versionr!s rr5r5Bs��� S�&�y�$�7�7��!�)�X�6�6����)�)���� �S�S�S��<�C�C�D�#�a�&�&�Q�Q�R�R�R�����S�������&�&�&� �X� �s�/2� A1�0A,�,A1�sourcec���d�|���D��}d�|D��}|std���t|��dkr5td�d�|�������|d}t |��}t |��}|�|��s#td�||�����|S) 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. c�F�h|]}|�dd��d��S)r-rr)r7)r/r0s r� z&wheel_dist_info_dir..[s)��=�=�=�a�q�w�w�s�A���q�!�=�=�=rc�<�g|]}|�d���|��S)z .dist-info)�endswith)r/�ss rr2z'wheel_dist_info_dir..]s)��@�@�@�q�q�z�z�,�'?�'?�@��@�@�@rz.dist-info directory not foundrz)multiple .dist-info directories found: {}z, rz2.dist-info directory {!r} does not start with {!r})r6r �lenr9�joinr r.)rFr�subdirs� info_dirsr1� info_dir_name�canonical_names rrArATs���>�=�6�?�?�+<�+<�=�=�=�G�@�@�G�@�@�@�I� �A��?�@�@�@� �9�~�~����� 7� >� >�t�y�y��?S�?S� T� T� � � ���|�H�%�h�/�/�M�&�t�,�,�N� � #� #�N� 3� 3� �� @� G� G��.� � � � � � �Orr=c�� |�|��S#tttf$r}t d|�d|�����d}~wwxYw)Nzcould not read z file: )�readr�KeyError� RuntimeErrorr )rFr=r!s rr8r8use��G��{�{�4� � � �� ��,� /�G�G�G��E��E�E��E�E�F�F�F�����G���s��A�A�A� dist_info_dirc���|�d�}t||��} |���}n'#t$r}td|�d|�����d}~wwxYwt ���|��S)ziReturn the WHEEL metadata of an extracted wheel, if possible. Otherwise, raise UnsupportedWheel. z/WHEELzerror decoding rN)r8�decoder r r�parsestr)rFrWr=�wheel_contents� wheel_textr!s rrBrB~s���� #� #� #�D�-�f�d�;�;�N�B�#�*�*�,�,� � �� �B�B�B��@��@�@�1�@�@�A�A�A�����B���� �8�8� � �Z� (� (�(s�,� A�A � A� wheel_data.c��|d}|�td���|���} ttt|�d������S#t $rtd|�����wxYw)zbGiven WHEEL metadata, return the parsed Wheel-Version. Otherwise, raise UnsupportedWheel. z Wheel-VersionNzWHEEL is missing Wheel-Version�.zinvalid Wheel-Version: )r �strip�tuple�map�intr7� ValueError)r]� version_textrEs rrCrC�s����o�.�L����?�@�@�@�� � �"�"�G�F��S��g�m�m�C�0�0�1�1�2�2�2�� �F�F�F��D��D�D�E�E�E�F���s �4A$�$BrEc �b�|dtdkrItd�|d�t t |���������|tkrCt �dd�t t |������dSdS)a�Raises errors or warns if called with an incompatible Wheel-Version. pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given rzB{}'s Wheel-Version ({}) is not compatible with this version of pipr_z*Installing from a newer Wheel-Version (%s)N)�VERSION_COMPATIBLEr r9rNrbr&�logger�warning)rErs rrDrD�s����q�z�&�q�)�)�)�� ��V�D�#�(�(�3�s�G�+<�+<�"=�"=�>�>� � � � �%� %� %���� 8� �H�H�S��g�&�&� '� '� � � � � � &� %r)$r%�logging� email.messager� email.parserr�typingrr�zipfilerr�pip._vendor.packaging.utilsr �pip._vendor.pkg_resourcesr r �pip._internal.exceptionsr �!pip._internal.utils.pkg_resourcesr rg� getLoggerr"rhrr&r?r5rAr'r8rBrcrCrD�rr�rus\��������!�!�!�!�!�!���������������'�'�'�'�'�'�'�'�9�9�9�9�9�9�H�H�H�H�H�H�H�H�5�5�5�5�5�5�:�:�:�:�:�:��� �� �8� $� $�������L����&Y��Y�!�Y�-0�Y��Y�Y�Y�Y�2�7��#��%��W� �2E�����$���s��s�����BG�W�G�C�G�E�G�G�G�G�)�7�)�3�)�7�)�)�)�)�& F�g� F�%��S��/� F� F� F� F�  ��s�C�x�� �� �� � � � � � r