o
     zqfs	                     @   sP   d dl mZ d dlm  mZ d dlZd dlZddlm	Z	 G dd dejZdS )    )logN   )ensure_directoryc                   @   s2   e Zd ZdZdd Zdd Zdd Zdd	d
ZdS )install_scriptsz;Do normal script install, plus any egg_info wrapper scriptsc                 C   s   t j|  d| _d S )NF)origr   initialize_optionsno_epself r   a/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/command/install_scripts.pyr      s   
z"install_scripts.initialize_optionsc                 C   s<   |  d | jjrtj|  ng | _| jrd S |   d S )Negg_info)	run_commanddistribution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r8|g}| }|j |}	|||	 D ]}
| j|
  qLd S )Nr   )DistributionPathMetadata   )easy_installr   build_scripts
executable)pkg_resourcesr   r    r   get_finalized_commandegg_baser   egg_nameegg_versiongetattrScriptWritersysr   bestcommand_spec_class
from_paramget_args	as_headerwrite_script)r
   r   r   eiei_cmddistbs_cmd
exec_paramwritercmdargsr   r   r   r      s&   


z#install_scripts._install_ep_scriptstc                 G   s   ddl m}m} td|| j tj| j|}| j	
| d|v r$dnd}| }	| jsWt| t|d| |d}
|
| W d   n1 sIw   Y  ||d	|	  dS dS )
z1Write an executable file to the scripts directoryr   )chmodcurrent_umaskzInstalling %s script to %sbNzutf-8w)encodingi  )setuptools.command.easy_installr2   r3   r   infoinstall_dirospathjoinr   appenddry_runr   openwrite)r
   script_namecontentsmodeignoredr2   r3   targetr6   maskfr   r   r   r(   4   s   zinstall_scripts.write_scriptN)r1   )__name__
__module____qualname____doc__r   r   r   r(   r   r   r   r   r   	   s    r   )
	distutilsr   !distutils.command.install_scriptscommandr   r   r:   r"   _pathr   r   r   r   r   <module>   s    