a
    âõ0`Ç  ã                   @   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 )z†distutils.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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 to)zinstall-layoutNzcustom installation layoutc                 C   s   d | _ d | _d | _d S ©N)Úinstall_dirÚinstall_layoutÚprefix_option©Úself© r   ú8/usr/lib/python3.9/distutils/command/install_egg_info.pyÚinitialize_options   s    z#install_egg_info.initialize_optionsc                 C   sæ   |   dd¡ |   dd¡ |   dd¡ | jrP| j ¡ dvr@tdƒ‚| j ¡ dk}n| jr\d	}nd
}|rŽdtt| j ¡ ƒƒtt	| j 
¡ ƒƒf }n8dtt| j ¡ ƒƒtt	| j 
¡ ƒƒgtjd d… ¢R  }tj | j|¡| _| jg| _d S )NZinstall_lib)r   r   Zinstall)r	   r	   )r
   r
   )ÚdebZunixz"unknown value for --install-layoutr   FTz%s-%s.egg-infoz%s-%s-py%d.%d.egg-infoé   )Zset_undefined_optionsr	   ÚlowerZDistutilsOptionErrorr
   Úto_filenameÚ	safe_nameÚdistributionZget_nameÚsafe_versionZget_versionÚsysÚversion_infoÚosÚpathÚjoinr   ÚtargetÚoutputs)r   Zno_pyverÚbasenamer   r   r   Úfinalize_options   s2    ÿþþý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sÌt|ddd}| jj |¡ W d   ƒ n1 sÂ0    Y  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   ÚmetadataZwrite_pkg_file)r   r   Úfr   r   r   Úrun4   s    ÿzinstall_egg_info.runc                 C   s   | j S r   )r   r   r   r   r   Úget_outputsB   s    zinstall_egg_info.get_outputsN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Z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 '-'.
    ú[^A-Za-z0-9.]+ú-)ÚreÚsub©Únamer   r   r   r   J   s    r   c                 C   s   |   dd¡} t dd| ¡S )zÌConvert 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.
    ú Ú.r2   r3   )Úreplacer4   r5   )Úversionr   r   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 '_'.
    r3   Ú_)r:   r6   r   r   r   r   \   s    r   )r1   Zdistutils.cmdr   Z	distutilsr   r   r   r   r4   r   r   r   r   r   r   r   r   Ú<module>   s   ?
