o
    bc                     @   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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   9/usr/lib/python3.10/distutils/command/install_egg_info.pyinitialize_options   s   
z#install_egg_info.initialize_optionsc                 C   s   |  dd |  dd |  dd | jr(| j dvr td| j dk}n| jr.d	}nd
}|rGdtt| j tt	| j
 f }ndtt| j tt	| j
 gtjd d R  }tj| j|| _| jg| _d S )Ninstall_lib)r   r   install)r	   r	   )r
   r
   )debunixz"unknown value for --install-layoutr   FTz%s-%s.egg-infoz%s-%s-py%d.%d.egg-info   )set_undefined_optionsr	   lowerDistutilsOptionErrorr
   to_filename	safe_namedistributionget_namesafe_versionget_versionsysversion_infoospathjoinr   targetoutputs)r   no_pyverbasenamer   r   r   finalize_options   s2   z!install_egg_info.finalize_optionsc                 C   s   | j }tj|rtj|stj|| jd n'tj|r+| 	tj
| j fd|  ntj| js?| 	tj| jfd| j  td| | jsit|ddd}| jj| W d    d S 1 sbw   Y  d S d S )N)dry_runz	Removing z	Creating z
Writing %swzUTF-8)encoding)r#   r    r!   isdirislinkr   remove_treer(   existsexecuteunlinkr   makedirsr   infoopenr   metadata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__descriptionuser_optionsr   r'   r7   r8   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 )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.
     .r?   r@   )replacerA   rB   )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 '_'.
    r@   _)rG   rC   r   r   r   r   \   s   r   )r<   distutils.cmdr   	distutilsr   r   r    r   rA   r   r   r   r   r   r   r   r   <module>   s    ?
