U e5d��@s�dZddlZddlZddlmZmZddlmZddlm Z ddd�Z d d �Z dd d �Z ej d krjdadaddd�Zddd�ZdS)z�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. �N)�DistutilsPlatformError�DistutilsExecError)�DEBUG)�log�cCsNt|�}tjdkr"t|||d�n(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 �execvp�execv�sys�platform� _cfg_target� distutilsr'Zget_config_var�split�_cfg_target_split�environ�getr�dict�execvpe�execve�forkr#r�stderr�write�strerror�_exit�waitpidrr� WIFSIGNALED�WTERMSIG� WIFEXITED� WEXITSTATUS� WIFSTOPPED)rrrrr$Zexec_fn�envr'Z cur_targetZmy_msg�pid�eZstatusr%Z exit_statusrrrr Ws�  ����  � �  ��   �� ��r c Cs�tj�|�\}}tjdkr*|dkr*|d}tj�|�r:|S|dkr�tj�dd�}|dkr�zt�d�}Wnt t fk r�tj }YnX|s�dS|� tj �}|D]&}tj�||�}tj�|�r�|Sq�dS)z�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. Zwin32z.exeN�PATH�CS_PATH)r �path�splitextr3r4�isfiler9r:�confstr�AttributeError� ValueError�defpathr7�pathsepr )r$rN�_Zext�paths�p�frrrr�s(     r)rrr)rrr)rrr)N)�__doc__r3r Zdistutils.errorsrrZdistutils.debugrr6rrrrr4r5r8r rrrrr�s      R