o
    6‘ði  ã                   @  sn   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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r§t	|dƒ�}t|dd� |¡ W d  ƒ n1 s¢w   Y  t|	ƒ}t j ||› d|› d�¡}t|dƒ�}td|› d�ddd� | ˆ ¡ W d  ƒ n1 sØw   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   úS/root/parts/websockify/install/lib/python3.10/site-packages/wheel/_commands/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   

þ

ÿÿûÿþrB   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>Q   ó    z"compute_tagline.<locals>.<setcomp>c                 S  rD   )r"   r   rE   rG   r   r   r   rI   R   rJ   c                 S  rD   )r"   r   rE   rG   r   r   r   rI   S   rJ   r"   Ú.)Úsortedr   )r=   ÚimplsÚabiversÚ	platformsr   r   r   r4   K   s   "r4   )r   r	   r
   r	   r   r   r   r   )r=   rC   r   r	   )Ú
__future__r   Úemail.policyr.   Úos.pathr   ÚreÚemail.generatorr   Úemail.parserr   Ú	wheelfiler   r   Úcompiler   rB   r4   r   r   r   r   Ú<module>   s    

=