HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_internal/utils/__pycache__/wheel.cpython-310.pyc
o

@%Ne��@sdZddlZddlmZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZd	Ze�e�Zd
e
dedeeeffd
d�Zde
dedefdd�Zde
dedefdd�Zde
dedefdd�Zdedeedffdd�Zdeedfdeddfdd�ZdS)z0Support functions for working with wheel files.
�N)�Message)�Parser)�Tuple)�
BadZipFile�ZipFile)�canonicalize_name)�UnsupportedWheel)�r�	wheel_zip�name�returnc
Cs`zt||�}t||�}t|�}Wnty&}z
td�|t|����d}~wwt||�||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.
    z{} has an invalid wheel, {}N)�wheel_dist_info_dir�wheel_metadata�
wheel_versionr�format�str�check_compatibility)r
r�info_dir�metadata�version�e�r�;/usr/lib/python3/dist-packages/pip/_internal/utils/wheel.py�parse_wheels

��
r�sourcecCs�dd�|��D�}dd�|D�}|std��t|�dkr&td�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.
    cSsh|]
}|�dd�d�qS)�/r	r)�split)�.0�prrr�	<setcomp>-sz&wheel_dist_info_dir.<locals>.<setcomp>cSsg|]	}|�d�r|�qS)z
.dist-info)�endswith)r�srrr�
<listcomp>/sz'wheel_dist_info_dir.<locals>.<listcomp>z.dist-info directory not foundr	z)multiple .dist-info directories found: {}z, rz2.dist-info directory {!r} does not start with {!r})�namelistr�lenr�joinr�
startswith)rr�subdirs�	info_dirsr�
info_dir_name�canonical_namerrrr
&s$�
��r
�pathc
Cs@z|�|�WStttfy}z
td|�d|����d}~ww)Nzcould not read z file: )�readr�KeyError�RuntimeErrorr)rr+rrrr�read_wheel_metadata_fileGs��r/�
dist_info_dirc
CsZ|�d�}t||�}z|��}Wnty&}z
td|�d|����d}~wwt��|�S)ziReturn the WHEEL metadata of an extracted wheel, if possible.
    Otherwise, raise UnsupportedWheel.
    z/WHEELzerror decoding z: N)r/�decode�UnicodeDecodeErrorrr�parsestr)rr0r+�wheel_contents�
wheel_textrrrrrPs

��r�
wheel_data.cCsT|d}|durtd��|��}zttt|�d���WSty)td|����w)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�intr�
ValueError)r6�version_textrrrrrcs�rrc	CsT|dtdkrtd�|d�tt|�����|tkr(t�dd�tt|���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 pipr7z*Installing from a newer Wheel-Version (%s)N)�VERSION_COMPATIBLErrr%r:r�logger�warning)rrrrrrss���r)�__doc__�logging�
email.messager�email.parserr�typingr�zipfilerr�pip._vendor.packaging.utilsr�pip._internal.exceptionsrr>�	getLogger�__name__r?rrr
�bytesr/rr;rrrrrr�<module>s 
!	"