B ۙ\@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(tjdkrt | } | dkr"dSts,|}td|| fn,t!| rPqvntsZ|}td|| fqvWdS)Nrrr$MACOSX_DEPLOYMENT_TARGETcSsg|] }t|qSr)int).0xrrr esz _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: %srz"command %r terminated by signal %dz%command %r failed with exit status %dz1unknown error executing %r: termination status %d)"rrrr execvpexecvsysplatform _cfg_targetr%Zget_config_varsplit_cfg_target_splitenvirongetrdictexecvpeexecveforkr!rstderrwritestrerror_exitwaitpidrr WIFSIGNALEDWTERMSIG WIFEXITED WEXITSTATUS WIFSTOPPED)rrrrr"Zexec_fnenvZ cur_targetZmy_msgpideZstatusr#Z exit_statusrrrr Xs      &     r cCs|dkrtjdtj}|tj}tj|\}}tj dkrN|dkrN|d}tj |sx*|D]"}tj ||}tj |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 r4r5defpathr2pathseppathsplitextr/r0isfiler)r"rJpathsbaseZextpfrrrrs    r)rrr)rrr)rrr)N)__doc__r/r Zdistutils.errorsrrZdistutils.debugrZ distutilsrrrrr0r%r1r3r rrrrrs       Q