o
    
_ßd’  ã                   @   sˆ   d 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 ddlmZ dd	lmZ G d
d„ de	ƒZdd„ Zdd„ ZdS )zD
Create a dist_info directory
As defined in the wheel specification
é    N)Úcontextmanager)Úlog)ÚCommand)ÚPathé   )Ú_normalization)ÚSetuptoolsDeprecationWarningc                   @   sZ   e Zd ZdZdZg d¢ZddgZddiZdd„ Zd	d
„ Z	e
dedefdd„ƒZ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	egg-base=Úezjdirectory containing .egg-info directories (default: top of the source tree) DEPRECATED: use --output-dir.)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| _d S )NF)Úegg_baseÚ
output_dirÚnameÚdist_info_dirÚtag_dateÚ	tag_buildÚkeep_egg_info)Úself© r   ú<lib/python3.10/site-packages/setuptools/command/dist_info.pyÚinitialize_options1   s   
zdist_info.initialize_optionsc                 C   sæ   | j rd}tj|dd | j p| j| _| j}|jptj}t| jp!|ƒ| _|  	d¡}t
| jƒ|_ | jr7| j|_n|j| _| jrC| j|_n|j| _| ¡  || _t | ¡ ¡}t | ¡ ¡}|› d|› | _tj | j| j› d¡| _d S )NzA--egg-base is deprecated for dist_info command. Use --output-dir.)iç  é	   é   )Zdue_dateÚegg_infoú-z
.dist-info)r   r   Úemitr   ZdistributionZsrc_rootÚosÚcurdirr   Zreinitialize_commandÚstrr   r   Úfinalize_optionsr   r   Z
safer_nameZget_nameZsafer_best_effort_versionZget_versionr   ÚpathÚjoinr   )r   ÚmsgZdistZproject_dirr   r   Úversionr   r   r   r%   :   s*   


zdist_info.finalize_optionsÚdir_pathÚrequires_bkpc              
   c   sv    |r6|› d}t |dd t||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Ú_copyÚshutilÚmove)r   r*   r+   Zbkp_namer   r   r   Ú_maybe_bkp_dir[   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¡}|  || j¡ | || j¡ W d   ƒ d S 1 sGw   Y  d S )NT)ÚparentsÚexist_okz&.egg-info dir should have been createdzcreating '{}'Úbdist_wheel)r   Úmkdirr   Úrunr"   r&   Úisdirr   ÚinfoÚformatÚabspathr   Zget_finalized_commandr3   r   Zegg2dist)r   Zegg_info_dirr6   r   r   r   r8   i   s   

"ÿzdist_info.runN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionZuser_optionsZboolean_optionsZnegative_optr   r%   r   r$   Úboolr3   r8   r   r   r   r   r	      s    	!r	   c                 K   s&   t j | ¡rtj| fi |¤Ž d S d S )N)r"   r&   r9   r1   Úrmtree)Zdir_nameÚoptsr   r   r   r/   w   s   ÿr/   c                 K   s.   t jdk r| dd ¡ tj| |fi |¤Ž d S )N)é   é   r-   )ÚsysÚversion_infoÚpopr1   Úcopytree)ÚsrcÚdstrD   r   r   r   r0   |   s   
r0   )r@   r"   r1   rG   Ú
contextlibr   Ú	distutilsr   Zdistutils.corer   Úpathlibr   Ú r   Úwarningsr   r	   r/   r0   r   r   r   r   Ú<module>   s    e