U e5d@sdZddlZddlZddlmZmZddlmZddlm Z dddZ d d Z dd d Z ej d krjdadadddZdddZdS)zdistutils.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. N)DistutilsPlatformErrorDistutilsExecError)DEBUG)logcCsNt|}tjdkr"t|||dn(tjdkresz _spawn_posix...cSsg|] }t|qSrr*r,rrrr/kszF$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure)r(zunable to execute %r: %s rz(unable to execute %r for unknown reasonsrrz"command %r terminated by signal %drz1unknown error executing %r: termination status %d)#rrr r execvpexecvsysplatform _cfg_target distutilsr'Zget_config_varsplit_cfg_target_splitenvirongetrdictexecvpeexecveforkr#rstderrwritestrerror_exitwaitpidrr WIFSIGNALEDWTERMSIG WIFEXITED WEXITSTATUS WIFSTOPPED)rrrrr$Zexec_fnenvr'Z cur_targetZmy_msgpideZstatusr%Z exit_statusrrrr Ws           r c Cstj|\}}tjdkr*|dkr*|d}tj|r:|S|dkrtjdd}|dkrztd}Wnt t fk rtj }YnX|sdS| tj }|D]&}tj||}tj|r|SqdS)zTries 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. Zwin32z.exeNPATHCS_PATH)r pathsplitextr3r4isfiler9r:confstrAttributeError ValueErrordefpathr7pathsepr )r$rN_Zextpathspfrrrrs(     r)rrr)rrr)rrr)N)__doc__r3r Zdistutils.errorsrrZdistutils.debugrr6rrrrr4r5r8r rrrrrs      R