HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc
a

g��e��@s�dZddlZddlmZddlmZddlmZmZddl	m
Z
mZddlm
Z
ddlmZmZdd	lmZdd
lmZdZe�e�ZGdd
�d
e�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dS)z0Support functions for working with wheel files.
�N)�Message)�Parser)�Dict�Tuple)�
BadZipFile�ZipFile)�canonicalize_name)�DistInfoDistribution�Distribution)�UnsupportedWheel)�DictMetadata)�rcs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
WheelMetadatazaMetadata provider that maps metadata decoding exceptions to our
    internal exception type.
    cst��|�||_dS)N)�super�__init__�_wheel_name)�self�metadataZ
wheel_name��	__class__��=/usr/lib/python3.9/site-packages/pip/_internal/utils/wheel.pyrszWheelMetadata.__init__c
sNzt��|�WStyH}z"td|j�d|����WYd}~n
d}~00dS)NzError decoding metadata for �: )r�get_metadata�UnicodeDecodeErrorrr)r�name�errrr s�zWheelMetadata.get_metadata)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rrrrrsrc
s�t||�\�}�fdd�|��D�}i}|D]`}|�dd�\}}zt||�||<Wq,ty�}z td�|t|����WYd}~q,d}~00q,t||�}	t||	|d�S)zaGet a pkg_resources distribution given a wheel.

    :raises UnsupportedWheel: on any errors
    cs g|]}|���d��r|�qS)�/)�
startswith��.0�p��info_dirrr�
<listcomp>3�z8pkg_resources_distribution_for_wheel.<locals>.<listcomp>r"r
�{} has an invalid wheel, {}N)�locationrZproject_name)	�parse_wheel�namelist�split�read_wheel_metadata_filer�format�strrr	)
�	wheel_ziprr,�_Zmetadata_filesZ
metadata_text�pathZ
metadata_namerrrr'r�$pkg_resources_distribution_for_wheel+s,
r6c
Cslz t||�}t||�}t|�}Wn8tyX}z td�|t|����WYd}~n
d}~00t||�||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.
    r+N)�wheel_dist_info_dir�wheel_metadata�
wheel_versionrr1r2�check_compatibility)r3rr(r�versionrrrrr-Cs

*
r-cCs�dd�|��D�}dd�|D�}|s,td��t|�dkrLtd�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
r)r/r$rrr�	<setcomp>^r*z&wheel_dist_info_dir.<locals>.<setcomp>cSsg|]}|�d�r|�qS)z
.dist-info)�endswith)r%�srrrr)`r*z'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})r.r�lenr1�joinrr#)�sourcer�subdirsZ	info_dirsr(Z
info_dir_nameZcanonical_namerrrr7Vs$�
��r7c
CsPz|�|�WStttfyJ}z td|�d|����WYd}~n
d}~00dS)Nzcould not read z file: )�readr�KeyError�RuntimeErrorr)rAr5rrrrr0xsr0c
Csf|�d�}t||�}z|��}Wn8tyX}z td|�d|����WYd}~n
d}~00t��|�S)ziReturn the WHEEL metadata of an extracted wheel, if possible.
    Otherwise, raise UnsupportedWheel.
    z/WHEELzerror decoding rN)r0�decoderrrZparsestr)rAZ
dist_info_dirr5Zwheel_contentsZ
wheel_textrrrrr8�s

*r8cCs\|d}|durtd��|��}zttt|�d���WStyVtd|����Yn0dS)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)Z
wheel_dataZversion_textr;rrrr9�sr9c	CsR|dtdkr.td�|d�tt|�����n |tkrNt�dd�tt|���dS)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 piprGz*Installing from a newer Wheel-Version (%s)N)�VERSION_COMPATIBLErr1r@rJr2�loggerZwarning)r;rrrrr:�s
���r:)!r ZloggingZ
email.messagerZemail.parserr�typingrr�zipfilerrZpip._vendor.packaging.utilsrZpip._vendor.pkg_resourcesr	r
Zpip._internal.exceptionsrZ!pip._internal.utils.pkg_resourcesrrMZ	getLoggerrrNrr6r-r7r0r8r9r:rrrr�<module>s&
"