U
    aÊ¹j´  ã                   @   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 G dd„ deƒZdd„ ZdS )zD
Create a dist_info directory
As defined in the wheel specification
é    N)Úcontextmanager)ÚPath)Úcasté   )Ú_normalizationé   )Úegg_info)Úlog)ÚCommandc                   @   s^   e Zd ZdZdZdddddg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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   ú[/var/www/html/bwave/python/venv/lib/python3.8/site-packages/setuptools/command/dist_info.pyÚinitialize_options+   s    zdist_info.initialize_optionsc                 C   sÆ   | j }|jptj}t| jp|ƒ| _tt|  d¡ƒ}t	| jƒ|_
| jrN| j|_n|j| _| jrf| j|_n|j| _| ¡  || _t | ¡ ¡}t | ¡ ¡}|› d|› �| _tj | j| j› d�¡| _d S )Nr   ú-z
.dist-info)ÚdistributionZsrc_rootÚosÚcurdirr   r   r   Úegg_info_clsÚreinitialize_commandÚstrZegg_baser   r   Úfinalize_optionsr   r   Z
safer_nameÚget_nameZsafer_best_effort_versionÚget_versionr   ÚpathÚjoinr   )r   ÚdistZproject_dirr   r   Úversionr   r   r   r$   3   s"    

zdist_info.finalize_options)Údir_pathÚrequires_bkpc              
   c   s^   |rT|› d�}t |dd� tj||ddd� z
d V  W 5 t |dd� t ||¡ X nd V  d S )Nz.__bkp__T)Úignore_errors)Údirs_exist_okÚsymlinks)Ú_rmÚshutilÚcopytreeÚmove)r   r+   r,   Zbkp_namer   r   r   Ú_maybe_bkp_dirM   s    

zdist_info._maybe_bkp_dirc              	   C   s†   | j jddd� | j ¡  | jj}tj |¡s6tdƒ‚t 	d 
tj | j¡¡¡ |  d¡}|  || j¡� | || j¡ W 5 Q R X d S )NT)ÚparentsÚexist_okz&.egg-info dir should have been createdzcreating '{}'Úbdist_wheel)r   Úmkdirr   Úrunr   r'   ÚisdirÚAssertionErrorr	   ÚinfoÚformatÚabspathr   Úget_finalized_commandr4   r   Zegg2dist)r   Úegg_info_dirr7   r   r   r   r9   [   s    

zdist_info.runN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionÚuser_optionsÚboolean_optionsÚnegative_optr   r$   r   r#   Úboolr4   r9   r   r   r   r   r      s   ör   c                 K   s   t j | ¡rtj| f|Ž d S )N)r   r'   r:   r1   Úrmtree)Údir_nameÚoptsr   r   r   r0   i   s    r0   )rD   r   r1   Ú
contextlibr   Úpathlibr   Útypingr   Ú r   r   r!   Ú	distutilsr	   Údistutils.corer
   r   r0   r   r   r   r   Ú<module>   s   V