U
    aÊ¹j=
  ã                   @  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                   @  sH   e Zd ZU dZded< dd„ Zddœdd	„Zd
d„ Zdddœdd„ZdS )Úinstall_scriptsz;Do normal script install, plus any egg_info wrapper scriptsr   Údistributionc                 C  s   t j | ¡ d| _d S )NF)Úorigr   Úinitialize_optionsÚno_ep©Úself© r   úa/var/www/html/bwave/python/venv/lib/python3.8/site-packages/setuptools/command/install_scripts.pyr
      s    z"install_scripts.initialize_optionsÚNone)Úreturnc                 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|
Ž  q˜d 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)Úmodec              	   G  sš   ddl m}m} t d|| j¡ tj | j|¡}| j	 
|¡ d|krHdnd}|ƒ }	| js–t|ƒ t|d| |d��}
|
 |¡ W 5 Q R X ||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   