o
    ^+)h                     @   s   d Z ddlZddl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 dd	lmZ G d
d deZdedefddZdedefddZdd Zdd ZdS )zD
Create a dist_info directory
As defined in the wheel specification
    N)contextmanager)cleandoc)Path)Command)log)	packaging)SetuptoolsDeprecationWarningc                   @   sV   e 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create a .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   [C:\Users\User\Downloads\Proyecto_IoT\venv\Lib\site-packages\setuptools/command/dist_info.pyinitialize_options(   s   
zdist_info.initialize_optionsc                 C   s   | j rd}t|t | j p| j| _| j}|jptj}t	| jp || _| 
d}t| j|_ | jr6| j|_n|j| _| jrB| 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.egg_info-z
.dist-info)r   warningswarnr   r   distributionZsrc_rootoscurdirr   Zreinitialize_commandstrr   r   finalize_optionsr   _safeget_name_versionget_versionr   pathjoinr   )r   msgdistZproject_dirr   r   versionr   r   r   r%   1   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/   r0   Zbkp_namer   r   r   _maybe_bkp_dirP   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_commandr8   r   Zegg2dist)r   egg_info_dirr;   r   r   r   r=   ^   s   

"zdist_info.runN)__name__
__module____qualname__descriptionZuser_optionsZboolean_optionsZnegative_optr   r%   r   r$   boolr8   r=   r   r   r   r   r	      s    	r	   	componentreturnc                 C   s   t dd| S )zAEscape a component used to form a wheel name according to PEP 491z	[^\w\d.]+_)resub)rH   r   r   r   r&   l   s   r&   r.   c                 C   sl   |  dd}zttj| ddW S  tjjy5   d| d| d}tt| t	|
d Y S w )z0Convert an arbitrary string to a version string. .r   rJ   zInvalid version: zk.
        !!


        ###################
        # Invalid version #
        ###################
        z is not valid according to PEP 440.

        Please make sure specify a valid version for your package.
        Also note that future releases of setuptools may halt the build process
        if an invalid version is given.
        

!!
        )replacer$   r   r.   VersionInvalidVersionr   r    r   r&   strip)r.   vr,   r   r   r   r(   q   s   r(   c                 K   s&   t j| rtj| fi | d S d S )N)r"   r*   r>   r6   rmtree)dir_nameoptsr   r   r   r4      s   r4   c                 K   s.   t jdk r|dd  tj| |fi | d S )N)      r2   )sysversion_infopopr6   copytree)srcdstrV   r   r   r   r5      s   
r5   )__doc__r"   rK   r6   rY   r   
contextlibr   inspectr   pathlibr   Zdistutils.corer   	distutilsr   Zsetuptools.externr   Zsetuptools._deprecation_warningr   r	   r$   r&   r(   r4   r5   r   r   r   r   <module>   s$    W