a
    6RhM
                     @  sh   d dl mZ d dlZd dlZddlmZ ddlmZ d dlm	  m
Z d dlmZ G dd dej
Z
dS )	    )annotationsN   )ensure_directory)Distribution)logc                   @  sP   e Zd ZU dZded< ddddZdddd	Zd
d ZddddddZdS )install_scriptsz;Do normal script install, plus any egg_info wrapper scriptsr   distributionNone)returnc                 C  s   t j|  d| _d S )NF)origr   initialize_optionsno_epself r   X/opt/python-3.9.24/usr/lib/python3.9/site-packages/setuptools/command/install_scripts.pyr      s    z"install_scripts.initialize_optionsc                 C  s<   |  d | jjr tj|  ng | _| jr0d S |   d S )Negg_info)	run_commandr   scriptsr   r   runoutfilesr   _install_ep_scriptsr   r   r   r   r      s    
zinstall_scripts.runc                 C  s   ddl m}m} ddlm} | d}||j||j|j|j|j	}| d}t
|dd }|j}|tjkrp|g}| }|j |}	|||	 D ]}
| j|
  qd S )Nr   )r   PathMetadata   )easy_installr   build_scripts
executable)pkg_resourcesr   r    r   get_finalized_commandZegg_baser   egg_nameZegg_versiongetattrZScriptWritersysr   bestZcommand_spec_classZ
from_paramget_argsZ	as_headerwrite_script)r   r   r   eiZei_cmddistZbs_cmdZ
exec_paramwritercmdargsr   r   r   r   !   s$    


z#install_scripts._install_ep_scriptststr)moder
   c                 G  s   ddl m}m} td|| j tj| j|}| j	
| d|v rHdnd}| }	| jst| t|d| |d}
|
| W d   n1 s0    Y  ||d	|	  dS )
z1Write an executable file to the scripts directoryr   )chmodcurrent_umaskzInstalling %s script to %sbNzutf-8w)encodingi  )Zsetuptools.command.easy_installr.   r/   r   infoZinstall_dirospathjoinr   appenddry_runr   openwrite)r   script_namecontentsr-   Zignoredr.   r/   targetr2   maskfr   r   r   r%   ;   s    (zinstall_scripts.write_scriptN)r+   )	__name__
__module____qualname____doc____annotations__r   r   r   r%   r   r   r   r   r      s   
r   )
__future__r   r4   r"   _pathr   r'   r   Z!distutils.command.install_scriptscommandr   r   	distutilsr   r   r   r   r   <module>   s   