
    Wht                        d Z ddlZddlmZ ddlmZ ddlmZmZ ddl	m
Z
 ddlmZ dZ ej        e          Zd	ed
edeeef         fdZded
edefdZdededefdZdededefdZdedeedf         fdZdeedf         d
eddfdZdS )z/Support functions for working with wheel files.    N)Message)Parser)
BadZipFileZipFile)canonicalize_name)UnsupportedWheel)   r   	wheel_zipnamereturnc                     	 t          | |          }t          | |          }t          |          }n&# t          $ r}t          | d|           d}~ww xY wt	          ||           ||fS )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/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/pip/_internal/utils/wheel.pyparse_wheelr      s    D&y$77!)X66)) D D D$BBqBBCCCD &&&Xs   /2 
AAAsourcec                    d |                                  D             }d |D             }|st          d          t          |          dk    r5t          d                    d                    |                              |d         }t          |          }t          |          }|                    |          st          d|d	|          |S )
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.
    c                 F    h | ]}|                     d d          d         S )/r	   r   )split).0ps     r   	<setcomp>z&wheel_dist_info_dir.<locals>.<setcomp>+   s)    ===aqwwsAq!===    c                 <    g | ]}|                     d           |S )z
.dist-info)endswith)r   ss     r   
<listcomp>z'wheel_dist_info_dir.<locals>.<listcomp>-   s)    @@@qqzz,'?'?@@@@r    z.dist-info directory not foundr	   z)multiple .dist-info directories found: {}z, r   z.dist-info directory z does not start with )namelistr   lenformatjoinr   
startswith)r   r   subdirs	info_dirsr   info_dir_namecanonical_names          r   r   r   $   s     >=6??+<+<===G@@G@@@I A?@@@
9~~7>>tyy?S?STT
 
 	
 |H%h//M&t,,N##N33 
WHWW^WW
 
 	
 Or    pathc                     	 |                      |          S # t          t          t          f$ r}t	          d|d|          d }~ww xY w)Nzcould not read z file: )readr   KeyErrorRuntimeErrorr   )r   r.   r   s      r   read_wheel_metadata_filer3   C   se    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}t          d|d|          d}~ww xY wt	                                          |          S )ziReturn the WHEEL metadata of an extracted wheel, if possible.
    Otherwise, raise UnsupportedWheel.
    z/WHEELzerror decoding z: N)r3   decodeUnicodeDecodeErrorr   r   parsestr)r   r4   r.   wheel_contents
wheel_textr   s         r   r   r   L   s     ###D-fd;;NB#**,,

 B B B@@@1@@AAAB 88Z(((s   , 
AAA
wheel_data.c                    | d         }|t          d          |                                }	 t          t          t          |                    d                              S # t          $ r t          d|          w xY w)zbGiven WHEEL metadata, return the parsed Wheel-Version.
    Otherwise, raise UnsupportedWheel.
    zWheel-VersionNzWHEEL is missing Wheel-Version.zinvalid Wheel-Version: )r   striptuplemapintr   
ValueError)r;   version_textr   s      r   r   r   _   s     o.L?@@@  ""GFSgmmC0011222 F F FDDDEEEFs   4A$ $Br   c                 b   | d         t           d         k    rIt          d                    |d                    t	          t
          |                                         | t           k    rCt                              dd                    t	          t
          |                                dS dS )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 pipr=   z*Installing from a newer Wheel-Version (%s)N)VERSION_COMPATIBLEr   r'   r(   r@   strloggerwarning)r   r   s     r   r   r   o   s     qz&q)))VD#((3sG+<+<"="=>>
 
 	
 
%	%	%8HHSg&&''	
 	
 	
 	
 	
 
&	%r    )__doc__loggingemail.messager   email.parserr   zipfiler   r   pip._vendor.packaging.utilsr   pip._internal.exceptionsr   rE   	getLogger__name__rG   rF   r?   r   r   bytesr3   r   rA   r   r    r    r   <module>rT      s   5 5  ! ! ! ! ! !       ' ' ' ' ' ' ' ' 9 9 9 9 9 9 5 5 5 5 5 5  
	8	$	$7 # %W2E    $ s s    >GW GC GE G G G G)7 )3 )7 ) ) ) )&Fg F%S/ F F F F 
sCx 
 
 
 
 
 
 
 
r    