�`^c@s�dZdZddlZddlZddlmZddlmZddlm Z ddl
mZddlm
Z
ejd �Zd
efd��YZdS(sRdistutils.command.build_scripts
Implements the Distutils 'build_scripts' command.s$Id$i�N(tST_MODE(tCommand(tnewer(tconvert_path(tlogs^#!.*python[0-9.]*([ ].*)?$t
build_scriptscBsSeZdZdddgZdgZd
�Zd�Zd�Zd
�Zd�Z RS(s("build" scripts (copy and fixup #! line)s
build-dir=tdsdirectory to "build" (copy) totforcetfs1forcibly build everything (ignore file timestampssexecutable=tes*specify final destination interpreter pathcCs1d|_d|_d|_d|_d|_dS(N(tNonet build_dirtscriptsRt
executabletoutfiles(tself((s5/sys/lib/python2.7/distutils/command/build_scripts.pytinitialize_optionss
cCs)|jdddd�|jj|_dS( NtbuildRRRR
(s
build_scriptss build_dir(sforcesforce(s
executables
executable(tset_undefined_optionstdistributionR(R((s5/sys/lib/python2.7/distutils/command/build_scripts.pytfinalize_options%s
cCs|jS(N(R(R((s5/sys/lib/python2.7/distutils/command/build_scripts.pytget_source_files,scCs|js
dS|j�dS(N(Rtcopy_scripts(R((s5/sys/lib/python2.7/distutils/command/build_scripts.pytrun/s c Cs�td�}|j|j�g}x|jD]}d}t|�}tjj|jtjj|��}|j |�|j
r�t||�r�tj
d|�q,nyt|d�}Wn&tk
r�|js��nd}n]X|j�}|s
|jd|�q,ntj|�}|r=d}|jd�p7d} n|rtjd||j�|jst|d �}
|j�s�|
jd
|j| f�nK|
jd
tjj|jd�d|jd
�|jd�f�| f�|
j|j��|
j�n|r>|j�q>q,|r.|j�n|j||�q,Wtj dkr�x�|D]|}|jrztjd|�qXtj!|�t"d@}|dBd@}
|
|krXtjd|||
�tj#||
�qXqXWndS(s"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.
t sysconfigisnot copying %s (up-to-date)trs%s is an empty file (skipping)itscopying and adjusting %s -> %stws#!%s%s
tBINDIRs
python%s%stVERSIONtEXEtposixschanging mode of %si�ims!changing mode of %s from %o to %oN($t
__import__tmkpathRRRtostpathtjointbasenametappendRRRtdebugtopentIOErrortdry_runR
treadlinetwarnt
first_line_retmatchtgrouptinfotis_python_buildtwriteR
tget_config_vart
writelinest readlinestcloset copy_filetnametstatRtchmod(Rt
_sysconfigRtscripttadjusttoutfileRt
first_lineR.tpost_interptoutftfiletoldmodetnewmode((s5/sys/lib/python2.7/distutils/command/build_scripts.pyR5sr$
(s
build-dir=Rsdirectory to "build" (copy) to(sforceRs1forcibly build everything (ignore file timestamps(sexecutable=R s*specify final destination interpreter path(
t__name__t
__module__tdescriptiontuser_optionstboolean_optionsRRRRR(((s5/sys/lib/python2.7/distutils/command/build_scripts.pyRs (t__doc__t__revision__R"treR9Rtdistutils.coreRtdistutils.dep_utilRtdistutils.utilRt distutilsRtcompileR-R(((s5/sys/lib/python2.7/distutils/command/build_scripts.pyt<module>s
|