a
    ydc                     @   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                   @   sX   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
eed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.9/site-packages/setuptools/command/dist_info.pyinitialize_options)   s    zdist_info.initialize_optionsc                 C   s   | j r&d}tj|dd | j p"| j| _| j}|jp6tj}t| jpB|| _| 	d}t
| j|_ | jrn| j|_n|j| _| jr| 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%   2   s*    


zdist_info.finalize_options)dir_pathrequires_bkpc              
   c   st   |rj| d}t |dd t||ddd z"d V  W t |dd t|| qpt |dd t|| 0 nd V  d S )Nz.__bkp__T)ignore_errors)dirs_exist_okZsymlinks)_rm_copyshutilZmove)r   r*   r+   Zbkp_namer   r   r   _maybe_bkp_dirS   s    
zdist_info._maybe_bkp_dirc                 C   s   | j jddd | j  | jj}tj|s6J dtd	tj
| j | d}| || j ||| j W d    n1 s0    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_commandr1   r   Zegg2dist)r   Zegg_info_dirr4   r   r   r   r6   a   s    

zdist_info.runN)__name__
__module____qualname____doc__ZdescriptionZuser_optionsZboolean_optionsZnegative_optr   r%   r   r$   boolr1   r6   r   r   r   r   r	      s   	!r	   c                 K   s"   t j| rtj| fi | d S )N)r"   r&   r7   r0   Zrmtree)Zdir_nameoptsr   r   r   r.   o   s    r.   c                 K   s.   t jdk r|dd  tj| |fi | d S )N)      r-   )sysversion_infopopr0   Zcopytree)srcZdstr@   r   r   r   r/   t   s    
r/   )r>   r"   r0   rC   
contextlibr   	distutilsr   Zdistutils.corer   pathlibr    r   warningsr   r	   r.   r/   r   r   r   r   <module>   s   ]