o
    5‘ðiù
  ã                   @   sx   d 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 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.
é    N)ÚClassVaré   )Údir_util)Úlog)ÚCommandc                   @   sb   e Zd ZU dZdZdgZeeee	e	e	f   e
d< dd„ Ze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Úuser_optionsc                 C   s
   d | _ d S ©N)Úinstall_dir©Úself© r   úm/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/_distutils/command/install_egg_info.pyÚinitialize_options   s   
z#install_egg_info.initialize_optionsc                 C   sH   t t| j ¡ ƒƒ}t t| j ¡ ƒƒ}|› d|› dtjj› dtjj	› d�S )z_
        Allow basename to be overridden by child class.
        Ref pypa/distutils#2.
        ú-z-pyÚ.z	.egg-info)
Úto_filenameÚ	safe_nameÚdistributionÚget_nameÚsafe_versionÚget_versionÚsysÚversion_infoÚmajorÚminor)r   ÚnameÚversionr   r   r   Úbasename   s   $zinstall_egg_info.basenamec                 C   s.   |   dd¡ tj | j| j¡| _| jg| _d S )NÚinstall_lib)r   r   )Úset_undefined_optionsÚosÚpathÚjoinr   r   ÚtargetÚoutputsr   r   r   r   Úfinalize_options'   s   z!install_egg_info.finalize_optionsc                 C   sÆ   | j }tj |¡rtj |¡st |¡ n'tj |¡r(|  tj	| j fd| ¡ ntj | j
¡s<|  tj| j
fd| j
 ¡ t d|¡ t|ddd��}| jj |¡ W d   ƒ d S 1 s\w   Y  d S )Nz	Removing z	Creating z
Writing %sÚwzUTF-8)Úencoding)r%   r"   r#   ÚisdirÚislinkr   Úremove_treeÚexistsÚexecuteÚunlinkr   Úmakedirsr   ÚinfoÚopenr   ÚmetadataÚwrite_pkg_file)r   r%   Úfr   r   r   Úrun,   s   ÿ"ÿzinstall_egg_info.runc                 C   s   | j S r
   )r&   r   r   r   r   Úget_outputs:   s   zinstall_egg_info.get_outputsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Údescriptionr	   r   ÚlistÚtupleÚstrÚ__annotations__r   Úpropertyr   r'   r6   r7   r   r   r   r   r      s   
 ÿ
	r   c                 C   s   t  dd| ¡S )z�Convert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    ú[^A-Za-z0-9.]+r   )ÚreÚsub©r   r   r   r   r   C   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.
    ú r   rB   r   )ÚreplacerC   rD   )r   r   r   r   r   K   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   rE   r   r   r   r   U   s   r   )r;   r"   rC   r   Útypingr   Ú r   Ú_logr   Úcmdr   r   r   r   r   r   r   r   r   Ú<module>   s    1
