o
    LK&h                     @  sv   d dl mZ d dlZd dlZd dlZd dlmZ d dl	m
Z
 d dlmZ d dlmZ edZdddZdddZdS )    )annotationsN)BytesGenerator)BytesParser)
WheelError)	WheelFilez6^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))\.dist-info$	directorystrdest_dirbuild_number
str | NonereturnNonec                   s   fddt  D }t|dkrtd  |s"td  |d }t|d}t j |d}t	|d	'}t
tjjd
|}|dg }	|d}
|	s[td| dW d   n1 sew   Y  |durp|n|
}|dur|d= |r||d< |d| 7 }||
krt	|d}t|dd| W d   n1 sw   Y  t|	}t j|| d| d}t|d}td| dddd |  W d   n1 sw   Y  td dS )aB  Repack a previously unpacked wheel directory into a new wheel file.

    The .dist-info/WHEEL file must contain one or more tags so that the target
    wheel file name can be determined.

    :param directory: The unpacked wheel directory
    :param dest_dir: Destination directory (defaults to the current directory)
    c                   s0   g | ]}t jt j |rt|r|qS  )ospathisdirjoinDIST_INFO_REmatch).0fnr   r   T/var/www/html/venv/lib/python3.10/site-packages/setuptools/_vendor/wheel/cli/pack.py
<listcomp>   s    zpack.<locals>.<listcomp>   z)Multiple .dist-info directories found in z#No .dist-info directories found in r   nameverWHEELrb)policyTagBuildzNo tags present in z./WHEEL; cannot determine target wheel filenameN-wb)maxheaderlenz.whlwzRepacking wheel as z... T)endflushOK)r   listdirlenr   r   r   groupr   r   openr   emailr   compat32parseget_allgetr   flattencompute_tagliner   printwrite_files)r   r	   r
   dist_info_dirsdist_info_dirname_versionwheel_file_pathfinfotagsexisting_build_numbertagline
wheel_pathwfr   r   r   pack   sJ   



rA   r<   	list[str]c                 C  sX   t dd | D }t dd | D }t dd | D }dd|d|d|gS )zcCompute a tagline from a list of tags.

    :param tags: A list of tags
    :return: A tagline
    c                 S     h | ]	}| d d qS )r!   r   splitr   tagr   r   r   	<setcomp>R       z"compute_tagline.<locals>.<setcomp>c                 S  rC   )r!   r   rD   rF   r   r   r   rH   S   rI   c                 S  rC   )r!      rD   rF   r   r   r   rH   T   rI   r!   .)sortedr   )r<   implsabivers	platformsr   r   r   r3   L   s   "r3   )r   r   r	   r   r
   r   r   r   )r<   rB   r   r   )
__future__r   email.policyr-   os.pathr   reemail.generatorr   email.parserr   	wheel.clir   wheel.wheelfiler   compiler   rA   r3   r   r   r   r   <module>   s    

=