Your IP : 3.137.174.253


Current Path : /opt/alt/python34/lib64/python3.4/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/command/__pycache__/build_scripts.cpython-34.pyo

�
h fW�@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZm
Z
ddlmZddlZejd	�ZGd
d�de�ZGdd
�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@sjeZdZdZdddgZdgZdd�Zd
d�Zdd�Zdd�Z	dd�Z
dS)�
build_scriptsz("build" scripts (copy and fixup #! line)�
build-dir=�d�directory to "build" (copy) to�force�f�1forcibly build everything (ignore file timestamps�executable=�e�*specify final destination interpreter pathcCs1d|_d|_d|_d|_d|_dS)N)�	build_dir�scriptsr
�
executable�outfiles)�self�r�D/opt/alt/python34/lib64/python3.4/distutils/command/build_scripts.py�initialize_optionss
				z build_scripts.initialize_optionscCs)|jdddd�|jj|_dS)	NZbuildr	rr
r)z
build_scriptsz	build_dir)�forcer)�
executabler)Zset_undefined_optionsZdistributionr)rrrr�finalize_options%s
	zbuild_scripts.finalize_optionscCs|jS)N)r)rrrr�get_source_files,szbuild_scripts.get_source_filescCs|js
dS|j�dS)N)r�copy_scripts)rrrr�run/s	zbuild_scripts.runc"Cs�|j|j�g}g}x�|jD]�}d}t|�}tjj|jtjj|��}|j|�|j	r�t
||�r�tjd|�q&nyt
|d�}Wn'tk
r�|js��nd}Yn�Xtj|j�\}}|jd�|j�}	|	s*|jd|�q&ntj|	�}
|
r]d}|
jd�pWd	}n|r�tjd
||j�|j|�|js�tjs�|j}n:tjjtjd�dtjd
�tjd�f�}tj|�}d||d}
y|
jd�Wn'tk
r9t dj!|
���YnXy|
j|�Wn*tk
rwt dj!|
|���YnXt
|d��'}|j"|
�|j#|j$��WdQXn|r�|j%�q�q&|r�|j%�n|j|�|j&||�q&Wtj'dkr�x�|D]|}|jr5tjd|�qtj(|�t)d@}|dBd@}||krtjd|||�tj*||�qqWn||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 -> %s�BINDIRz
python%s%s�VERSION�EXEs#!s
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�appendr
rr�debug�open�OSError�dry_run�tokenize�detect_encoding�readline�seek�warn�
first_line_re�match�group�inforZpython_buildr�get_config_var�fsencode�decode�UnicodeDecodeError�
ValueError�format�write�
writelines�	readlines�closeZ	copy_file�name�statr�chmod)rr�
updated_filesZscriptZadjustZoutfiler�encoding�linesZ
first_liner8Zpost_interprZshebangZoutf�fileZoldmodeZnewmoderrrr5s�$

	


			





		
zbuild_scripts.copy_scriptsN)r
rr)zforcerr)rrr)�__name__�
__module__�__qualname__ZdescriptionZuser_optionsZboolean_optionsrrrr rrrrrr	s		r	c@seZdZdd�ZdS)�build_scripts_2to3cCs8tj|�\}}|js.|j|�n||fS)N)r	rr1Zrun_2to3)rrrHrrrr�s	zbuild_scripts_2to3.copy_scriptsN)rLrMrNrrrrrrO�srO)�__doc__r)�rerFrZ	distutilsrZdistutils.corerZdistutils.dep_utilrZdistutils.utilrrrr2�compiler7r	rOrrrr�<module>s�

?>