
    q"h                     "   S r SSKrSSKJr  SSKJr  SSKJr  SSKJ	r	J
r
  SSKJr  SSKJr  S	r\R                   " \5      rS
\
S\S\\\4   4S jrS\
S\S\4S jrS\
S\S\4S jrS\
S\S\4S jrS\S\\S4   4S jrS\\S4   S\SS4S jrg)z/Support functions for working with wheel files.    N)Message)Parser)Tuple)
BadZipFileZipFile)canonicalize_name)UnsupportedWheel)   r   	wheel_zipnamereturnc                      [        X5      n[        X5      n[        U5      n[	        XA5        X#4$ ! [         a  n[        U SU 35      eSnAff = f)zExtract 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         K/var/www/html/env/lib/python3.13/site-packages/pip/_internal/utils/wheel.pyparse_wheelr      sd    D&y7!)6) &  D$'>qcBCCDs   !1 
AAAsourcec                    U R                  5        Vs1 s H  o"R                  SS5      S   iM     nnU Vs/ s H  oDR                  S5      (       d  M  UPM     nnU(       d  [        S5      e[	        U5      S:  a)  [        SR                  SR                  U5      5      5      eUS   n[        U5      n[        U5      nUR                  U5      (       d  [        SU< S	U< 35      eU$ s  snf s  snf )
zReturns 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??+<=+<awwsAq!+<G=#@Gqzz,'?GI@?@@
9~7>>tyy?ST
 	
 |H%h/M&t,N##N33#H</D^DVW
 	
 O+ >@s   C,C1C1pathc                      U R                  U5      $ ! [        [        [        4 a  n[	        SU< SU< 35      eS nAff = f)Nzcould not read z file: )readr   KeyErrorRuntimeErrorr	   )r   r)   r   s      r   read_wheel_metadata_filer.   D   sJ    G{{4   ,/ GuEFFGs    A ;A dist_info_dirc                     U S3n[        X5      n UR                  5       n[	        5       R                  U5      $ ! [         a  n[        SU< SU< 35      eSnAff = f)zaReturn the WHEEL metadata of an extracted wheel, if possible.
Otherwise, raise UnsupportedWheel.
z/WHEELzerror decoding z: N)r.   decodeUnicodeDecodeErrorr	   r   parsestr)r   r/   r)   wheel_contents
wheel_textr   s         r   r   r   M   so     _F#D-f;NB#**,
 8Z((  B1%@AABs   ; 
AAA
wheel_data.c                     U S   nUc  [        S5      eUR                  5       n [        [        [        UR                  S5      5      5      $ ! [         a    [        SU< 35      ef = f)zZGiven WHEEL metadata, return the parsed Wheel-Version.
Otherwise, raise UnsupportedWheel.
zWheel-VersionzWHEEL is missing Wheel-Version.zinvalid Wheel-Version: )r	   striptuplemapintr   
ValueError)r6   version_textr   s      r   r   r   `   ss     o.L?@@  "GFSgmmC0122 F!8DEEFs   'A A'r   c                    U S   [         S   :  a8  [        SR                  USR                  [	        [
        U 5      5      5      5      eU [         :  a4  [        R                  SSR                  [	        [
        U 5      5      5        gg)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
r   zB{}'s Wheel-Version ({}) is not compatible with this version of pipr8   z*Installing from a newer Wheel-Version (%s)N)VERSION_COMPATIBLEr	   r    r!   r;   strloggerwarning)r   r   s     r   r   r   p   sv     qz&q))VD#((3sG+<"=>
 	
 
%	%8HHSg&'	
 
&    )__doc__loggingemail.messager   email.parserr   typingr   zipfiler   r   pip._vendor.packaging.utilsr   pip._internal.exceptionsr	   r@   	getLogger__name__rB   rA   r   r   bytesr.   r   r<   r   r    rD   r   <module>rQ      s    5  !   ' 9 5  
		8	$7 # %W2E $ s s >GW GC GE G)7 )3 )7 )&Fg F%S/ F 
sCx 
 
 
rD   