B
    v9a+
                 @   sd   d Z ddlmZ ddlmZmZ ddlZddlZddlZG dd deZ	dd Z
d	d
 Zdd ZdS )zdistutils.command.install_egg_info

Implements the Distutils 'install_egg_info' command, for installing
a package's PKG-INFO metadata.    )Command)logdir_utilNc               @   s:   e Zd ZdZdZdgZdd Zdd Zdd	 Zd
d Z	dS )install_egg_infoz)Install an .egg-info file for the packagez8Install package's PKG-INFO metadata as an .egg-info file)zinstall-dir=dzdirectory to install toc             C   s
   d | _ d S )N)install_dir)self r	   &/usr/lib/python3.7/install_egg_info.pyinitialize_options   s    z#install_egg_info.initialize_optionsc             C   sb   |  dd dtt| j tt| j ftjd d  }t	j
| j|| _| jg| _d S )NZinstall_lib)r   r   z%s-%s-py%d.%d.egg-info   )Zset_undefined_optionsto_filename	safe_namedistributionZget_namesafe_versionZget_versionsysversion_infoospathjoinr   targetoutputs)r   basenamer	   r	   r
   finalize_options   s    z!install_egg_info.finalize_optionsc          	   C   s   | j }tj|r0tj|s0tj|| jd nNtj|rV| 	tj
| j fd|  n(tj| js~| 	tj| jfd| j  td| | jst|ddd}| jj| W d Q R X d S )N)dry_runz	Removing z	Creating z
Writing %swzUTF-8)encoding)r   r   r   isdirislinkr   Zremove_treer   existsZexecuteunlinkr   makedirsr   infoopenr   ZmetadataZwrite_pkg_file)r   r   fr	   r	   r
   run    s    zinstall_egg_info.runc             C   s   | j S )N)r   )r   r	   r	   r
   get_outputs.   s    zinstall_egg_info.get_outputsN)
__name__
__module____qualname____doc__descriptionZuser_optionsr   r   r%   r&   r	   r	   r	   r
   r      s   
r   c             C   s   t dd| S )zConvert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    z[^A-Za-z0-9.]+-)resub)namer	   r	   r
   r   6   s    r   c             C   s   |  dd} tdd| S )zConvert an arbitrary string to a standard version string

    Spaces become dots, and all other non-alphanumeric characters become
    dashes, with runs of multiple dashes condensed to a single dash.
     .z[^A-Za-z0-9.]+r,   )replacer-   r.   )versionr	   r	   r
   r   >   s    r   c             C   s   |  ddS )z|Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    r,   _)r2   )r/   r	   r	   r
   r   H   s    r   )r*   Zdistutils.cmdr   Z	distutilsr   r   r   r   r-   r   r   r   r   r	   r	   r	   r
   <module>   s   +
