o
    5‘ðiz  ã                   @   sˆ   d 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
 ddlmZ d	d
lmZ ddlmZ ddlmZ G dd„ deƒZdS )zD
Create a dist_info directory
As defined in the wheel specification
é    N)Úcontextmanager)ÚPath)Úcasté   )Ú_normalization)Úrmdiré   )Úegg_info)Úlog)ÚCommandc                   @   s^   e Zd ZdZdZg d¢ZddgZddiZdd„ Zddd„Z	e
dedefdd„ƒZddd„Zd
S )Ú	dist_infoz‡
    This command is private and reserved for internal use of setuptools,
    users should rely on ``setuptools.build_meta`` APIs.
    z@DO NOT CALL DIRECTLY, INTERNAL ONLY: create .dist-info directory))zoutput-dir=ÚozYdirectory inside of which the .dist-info will becreated [default: top of the source tree])útag-dateÚdz0Add date stamp (e.g. 20050528) to version number)z
tag-build=Úbz-Specify explicit tag to add to version number)úno-dateÚDz"Don't include date stamp [default])úkeep-egg-infoNz,*TRANSITIONAL* will be removed in the futurer   r   r   c                 C   s(   d | _ d | _d | _d | _d | _d| _d S )NF)Ú
output_dirÚnameÚdist_info_dirÚtag_dateÚ	tag_buildÚkeep_egg_info)Úself© r   ú[/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/command/dist_info.pyÚinitialize_options,   s   
zdist_info.initialize_optionsÚreturnNc                 C   sÆ   | j }|jptj}t| jp|ƒ| _tt|  d¡ƒ}t	| jƒ|_
| jr'| j|_n|j| _| jr3| j|_n|j| _| ¡  || _t | ¡ ¡}t | ¡ ¡}|› d|› �| _tj | j| j› d�¡| _d S )Nr	   ú-z
.dist-info)ÚdistributionÚsrc_rootÚosÚcurdirr   r   r   Úegg_info_clsÚreinitialize_commandÚstrÚegg_baser   r   Úfinalize_optionsr	   r   Ú
safer_nameÚget_nameÚsafer_best_effort_versionÚget_versionr   ÚpathÚjoinr   )r   ÚdistÚproject_dirr	   r   Úversionr   r   r   r(   4   s"   

zdist_info.finalize_optionsÚdir_pathÚrequires_bkpc              
   c   sx   � |r7|› d�}t |dd� tj||ddd� zd V  W t |dd� t ||¡ d S t |dd� t ||¡ w d V  d S )Nz.__bkp__T)Úignore_errors)Údirs_exist_okÚsymlinks)Ú_rmÚshutilÚcopytreeÚmove)r   r2   r3   Úbkp_namer   r   r   Ú_maybe_bkp_dirN   s   €
ÿ
zdist_info._maybe_bkp_dirc                 C   sž   | j jddd� | j ¡  | jj}tj |¡sJ dƒ‚t dtj 	| j
¡› d�¡ |  d¡}|  || j¡� | || j
¡ W d   ƒ d S 1 sHw   Y  d S )NT)ÚparentsÚexist_okz&.egg-info dir should have been createdz
creating 'ú'Úbdist_wheel)r   Úmkdirr	   Úrunr"   r-   Úisdirr
   ÚinfoÚabspathr   Úget_finalized_commandr<   r   Úegg2dist)r   Úegg_info_dirr@   r   r   r   rB   \   s   

"ÿzdist_info.run)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionÚuser_optionsÚboolean_optionsÚnegative_optr   r(   r   r&   Úboolr<   rB   r   r   r   r   r      s    
r   )rL   r"   r8   Ú
contextlibr   Úpathlibr   Útypingr   Ú r   Ú_shutilr   r7   r	   r$   Ú	distutilsr
   Údistutils.corer   r   r   r   r   r   Ú<module>   s    