????
Your IP : 18.218.79.20
a
�DOgX�@s�dZddlZddlZddlmZddlmZddlmZddl m
Z
ddlmZm
Z
ddlmZddlZe�d �ZGd
d�de�ZGdd
�d
ee
�ZdS)zRdistutils.command.build_scripts
Implements the Distutils 'build_scripts' command.�N)�ST_MODE)� sysconfig)�Command)�newer)�convert_path� Mixin2to3)�logs^#!.*python[0-9.]*([ ].*)?$c@sFeZdZdZgd�ZdgZdd�Zdd�Zdd �Zd
d�Z dd
�Z
dS)�
build_scriptsz("build" scripts (copy and fixup #! line)))z
build-dir=�dzdirectory to "build" (copy) to)�force�fz1forcibly build everything (ignore file timestamps)zexecutable=�ez*specify final destination interpreter pathrcCs"d|_d|_d|_d|_d|_dS�N)� build_dir�scriptsr�
executable�outfiles��self�r�7/usr/lib64/python3.9/distutils/command/build_scripts.py�initialize_optionss
z build_scripts.initialize_optionscCs|�dddd�|jj|_dS)NZbuild)r r)rr)rr)Zset_undefined_optionsZdistributionrrrrr�finalize_options%s�zbuild_scripts.finalize_optionscCs|jSr)rrrrr�get_source_files,szbuild_scripts.get_source_filescCs|js
dS|��dSr)r�copy_scriptsrrrr�run/szbuild_scripts.runc Cs�|�|j�g}g}|jD�],}d}t|�}tj�|jtj�|��}|�|�|j slt
||�slt�d|�qzt
|d�}Wnty�|js��d}YnX0t�|j�\}}|�d�|��} | s�|�d|�qt�| �}
|
r�d}|
�d�p�d }|�r$t�d
||j�|�|�|j�stj�s(|j}n(tj�t�d�dt�d
�t�d�f�}t�|�}d||d}
z|
�d�Wn"t�y�t d�!|
���Yn0z|
�|�Wn$t�y�t d�!|
|���Yn0t
|d��(}|�"|
�|�#|�$��Wd�n1�s
0Y|�rH|�%�q|�r2|�%�|�|�|�&||�qtj'dk�r�|D]`}|j�rtt�d|�nDt�(|�t)d@}|dBd@}||k�rZt�d|||�t�*||��qZ||fS)a"Copy each script listed in 'self.scripts'; if it's marked as a
Python script in the Unix way (first line matches 'first_line_re',
ie. starts with "\#!" and contains "python"), then adjust the first
line to refer to the current Python interpreter as we copy.
Fznot copying %s (up-to-date)�rbNrz%s is an empty file (skipping)T��zcopying and adjusting %s -> %sZBINDIRz
python%s%s�VERSIONZEXEs#!�
zutf-8z.The shebang ({!r}) is not decodable from utf-8zAThe shebang ({!r}) is not decodable from the script encoding ({})�wb�posixzchanging mode of %si�imz!changing mode of %s from %o to %o)+Zmkpathrrr�os�path�join�basename�appendrrr�debug�open�OSError�dry_run�tokenize�detect_encoding�readline�seek�warn�
first_line_re�match�group�inforZpython_buildrZget_config_var�fsencode�decode�UnicodeDecodeError�
ValueError�format�write�
writelines� readlines�closeZ copy_file�name�statr�chmod)rr�
updated_filesZscriptZadjustZoutfiler�encoding�linesZ
first_liner2Zpost_interprZshebangZoutf�fileZoldmodeZnewmoderrrr5s�
�
��
��
��
.
�zbuild_scripts.copy_scriptsN)�__name__�
__module__�__qualname__�descriptionZuser_optionsZboolean_optionsrrrrrrrrrr sr c@seZdZdd�ZdS)�build_scripts_2to3cCs&t�|�\}}|js|�|�||fSr)r rr+Zrun_2to3)rrrArrrr�s
zbuild_scripts_2to3.copy_scriptsN)rErFrGrrrrrrI�srI)�__doc__r#�rer?rZ distutilsrZdistutils.corerZdistutils.dep_utilrZdistutils.utilrrrr,�compiler1r rIrrrr�<module>s