3 \@sdZddlZddlZddlmZmZddlmZddlm Z dddZ d d Z dd d Z ej d krvddlmZdadadddZdddZdS)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|qSr)r()r)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 reasonszcommand %r failed: %sz"command %r terminated by signal %dz%command %r failed with exit status %dz1unknown error executing %r: termination status %dr)"rrrr execvpexecvsysplatform _cfg_targetr%get_config_varsplit_cfg_target_splitenvirongetrdictexecvpeexecveforkr!rstderrwritestrerror_exitwaitpidrr WIFSIGNALEDWTERMSIG WIFEXITED WEXITSTATUS WIFSTOPPED)rrrrr"Zexec_fnenvZ cur_targetZmy_msgpideZstatusr#Z exit_statusrrrr Xs     &     r cCs|dkrtjjdtj}|jtj}tjj|\}}tj dkrN|dkrN|d}tjj |sx*|D]"}tjj ||}tjj |r`|Sq`WdS|SdS)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. NPATHZwin32z.exe) r r5r6defpathr3pathseppathsplitextr/r0isfiler)r"rKpathsbaseZextpfrrrrs    r)rrr)rrr)rrr)N)__doc__r/r Zdistutils.errorsrrZdistutils.debugrZ distutilsrrrrr0r%r1r4r rrrrrs       Q