File: //lib64/python3.9/distutils/command/__pycache__/install_egg_info.cpython-39.pyc
a
    �DOg+
  �                   @   sd   d Z ddlmZ ddlmZmZ ddlZddlZddlZG dd� de�Z	dd� Z
d	d
� Zdd� ZdS )
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 Zd ZdZdZdgZdd� Zdd� Zdd	� Zd
d� Z	dS )
�install_egg_infoz)Install an .egg-info file for the packagez8Install package's PKG-INFO metadata as an .egg-info file)zinstall-dir=�dzdirectory to install toc                 C   s
   d | _ d S �N)�install_dir��self� r   �:/usr/lib64/python3.9/distutils/command/install_egg_info.py�initialize_options   s    z#install_egg_info.initialize_optionsc                 C   sd   | � dd� dtt| j�� ��tt| j�� ��gtjd d� �R  }t	j
�| j|�| _
| j
g| _d S )NZinstall_lib)r   r   z%s-%s-py%d.%d.egg-info�   )Zset_undefined_options�to_filename�	safe_name�distribution�get_name�safe_versionZget_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 }tj�|�r0tj�|�s0tj|| jd� nNtj�|�rV| �	tj
| j fd| � n(tj�| j�s~| �	tj| jfd| j � t
�d|� | js�t|ddd��}| jj�|� W d   � n1 s�0    Y  d S )N)�dry_runz	Removing z	Creating z
Writing %s�wzUTF-8)�encoding)r   r   r   �isdir�islinkr   Zremove_treer   �existsZexecute�unlinkr   �makedirsr   �info�openr   �metadataZwrite_pkg_file)r
   r   �fr   r   r   �run    s    �zinstall_egg_info.runc                 C   s   | j S r   )r   r	   r   r   r   �get_outputs.   s    zinstall_egg_info.get_outputsN)
�__name__�
__module__�__qualname__�__doc__�descriptionZuser_optionsr
   r   r)   r*   r   r   r   r   r      s   �
r   c                 C   s   t �dd| �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.]+�-)�re�sub��namer   r   r   r   6   s    r   c                 C   s   | � dd�} t�dd| �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.
    � �.r0   r1   )�replacer2   r3   )�versionr   r   r   r   >