��Qc@s�dZdZddlZddlZddlmZmZddlmZdddd�Z d �Z
dddd
�Zdddd�Zej
dkr�dd
lmZdadandddd�Zdd�ZdS(s�distutils.spawn
Provides the 'spawn()' function, a front-end to various platform-
specific functions for launching another program in a sub-process.
Also provides the 'find_executable()' to search the path for a given
executable name.
s$Id$i�N(tDistutilsPlatformErrortDistutilsExecError(tlogiicCs�tjdkr%t||d|�nZtjdkrJt||d|�n5tjdkrot||d|�ntdtj�dS(s�Run another program, specified as a command list 'cmd', in a new process.
'cmd' is just the argument list for the new process, ie.
cmd[0] is the program to run and cmd[1:] are the rest of its arguments.
There is no way to run a program with a name different from that of its
executable.
If 'search_path' is true (the default), the system's executable
search path will be used to find the program; otherwise, cmd[0]
must be the exact path to the executable. If 'dry_run' is true,
the command will not actually be run.
Raise DistutilsExecError if running the program fails in any way; just
return on success.
tposixtdry_runtnttos2s1don't know how to spawn programs on platform '%s'N(tostnamet_spawn_posixt _spawn_ntt
_spawn_os2R(tcmdtsearch_pathtverboseR((sB/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/spawn.pytspawnscCs>x7t|�D])\}}d|kr
d|||<q
q
W|S(s�Quote command-line arguments for DOS/Windows conventions.
Just wraps every argument which contains blanks in double quotes, and
returns a new argument list.
t s"%s"(t enumerate(targstitarg((sB/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/spawn.pyt_nt_quote_args+scCs�|d}t|�}|r1t|�p+|}ntjdj|g|d��|s�ytjtj||�}Wn.tk
r�}t d|d|df�nX|dkr�t d|d|f�q�ndS(NiRiscommand '%s' failed: %si�s'command '%s' failed with exit status %d(
Rtfind_executableRtinfotjoinRtspawnvtP_WAITtOSErrorR(RR
RRt
executabletrctexc((sB/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/spawn.pyR
;s
!cCs�|d}|r%t|�p|}ntjdj|g|d��|s�ytjtj||�}Wn.tk
r�}td|d|df�nX|dkr�tj d|d|f�td|d|f�q�ndS(NiRiscommand '%s' failed: %si�s'command '%s' failed with exit status %d(
RRRRRRRRRtdebug(RR
RRRRR((sB/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/spawn.pyROs
!tdarwin(t sysconfigc
Cstjdj|��|r dS|r/tjp5tj}|d|g}tjdkrTtdkr�t
jd�pudatr�gtjd�D]}t
|�^q�aq�ntrTtjjdt�}tg|jd�D]}t
|�^q�krd|tf}t|��nttjd|�} |r8tjp>tj}|j| �qTntj�}
|
dkr�||�WnAtk
r�}tjjd|d|jf�tjd �nXtjjd
|d�tjd �nxytj|
d�\}
}WnRtk
rY}
ddl}|
j|jkr;q�td|d|
df�nXtj |�r�td
|dtj!|�f�q�j"|�r�tj#|�}|dkr�dStd|d|f�q�j$|�r���d|d|f�q�S(NRiR tMACOSX_DEPLOYMENT_TARGETtt.sF$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configuresunable to execute %s: %s
is(unable to execute %s for unknown reasonsi�scommand '%s' failed: %ss$command '%s' terminated by signal %ds'command '%s' failed with exit status %ds3unknown error executing '%s': termination status %d(%RRRRtexecvptexecvtsystplatformt_cfg_targettNoneR!tget_config_vartsplittintt_cfg_target_splittenvirontgetRtdicttexecvpetexecvetappendtforkRtstderrtwritetstrerrort_exittwaitpidterrnotEINTRRtWIFSIGNALEDtWTERMSIGt WIFEXITEDtWEXITSTATUSt
WIFSTOPPED(RR
RRtexec_fnt exec_argstxt
cur_targettmy_msgtenvtpidtetstatusRR;texit_status((sB/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/spawn.pyR hsp..
cCs�|dkrtjd}n|jtj�}tjj|�\}}tjdksdtj dkr}|dkr}|d}ntjj
|�s�x9|D]1}tjj||�}tjj
|�r�|Sq�WdS|SdS(s�Tries to find 'executable' in the directories listed in 'path'.
A string listing directories separated by 'os.pathsep'; defaults to
os.environ['PATH']. Returns the complete filename or None if not found.
tPATHtwin32Rs.exeN(R*RR/R,tpathseptpathtsplitextR'R(RtisfileR(RROtpathstbasetexttptf((sB/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/spawn.pyR�s*
(t__doc__t__revision__R'Rtdistutils.errorsRRt distutilsRRRR
RR(R!R*R)R.R R(((sB/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/spawn.pyt<module>s I
|