
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,a£  ã                   @   s‚   d Z ddlZddlZddlmZmZ ddlmZ ddlm	Z	 ddd„Z
d	d
„ Zddd„Zejdkrjdadaddd„Zddd„ZdS )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é   c                 C   sN   t | ƒ} tjdkr"t| ||d� n(tjdkr<t| ||d� ntdtj ƒ‚dS )a�  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.
    Úposix)Údry_runÚntz1don't know how to spawn programs on platform '%s'N)ÚlistÚosÚnameÚ_spawn_posixÚ	_spawn_ntr   )ÚcmdÚsearch_pathÚverboser   © r   ú4/opt/alt/python38/lib64/python3.8/distutils/spawn.pyÚspawn   s    

ÿr   c                 C   s*   t | ƒD ]\}}d|krd| | |< q| S )zªQuote command-line arguments for DOS/Windows conventions.

    Just wraps every argument which contains blanks in double quotes, and
    returns a new argument list.
    ú z"%s")Ú	enumerate)ÚargsÚiÚargr   r   r   Ú_nt_quote_args+   s    r   c              
   C   s¼   | d }t | ƒ} |r t|ƒp|}t d |g| dd …  ¡¡ |s¸zt tj|| ¡}W n@ tk
r– } z"t	sp|} t
d| |jd f ƒ‚W 5 d }~X Y nX |dkr¸t	s¨|} t
d| |f ƒ‚d S )Nr   r   r   úcommand %r failed: %séÿÿÿÿú%command %r failed with exit status %d)r   Úfind_executabler   ÚinfoÚjoinr   ÚspawnvÚP_WAITÚOSErrorr   r   r   )r   r   r   r   Ú
executableZrcÚexcr   r   r   r   ;   s(    ÿ
ÿr   Údarwinc              
   C   s|  t  d | ¡¡ |rd S | d }|r*tjp.tj}d }tjdkrÔtd krxddl	m
} | d¡p^datrxdd„ t d	¡D ƒatrÔtj dt¡}td
d„ | d	¡D ƒkr¶d|tf }	t|	ƒ‚ttj|d�}|rÎtjpÒtj}t ¡ }
|
dk�r€z$|d krü||| ƒ n||| |ƒ W nN tk
�rX } z.t�s(|} tj d| |jf ¡ t d¡ W 5 d }~X Y nX t�sd|} tj d|  ¡ t d¡ nøzt |
d¡\}
}W nD tk
�rØ } z$t�s²|} td| |jd f ƒ‚W 5 d }~X Y nX t |¡�rt�sð|} td| t |¡f ƒ‚nlt  |¡�rHt !|¡}|dk�r,d S t�s6|} td| |f ƒ‚n,t "|¡�rZ�q€nt�sd|} td| |f ƒ‚�q€d S )Nr   r   r&   )Ú	sysconfigÚMACOSX_DEPLOYMENT_TARGETÚ c                 S   s   g | ]}t |ƒ‘qS r   ©Úint©Ú.0Úxr   r   r   Ú
<listcomp>e   s     z _spawn_posix.<locals>.<listcomp>Ú.c                 S   s   g | ]}t |ƒ‘qS r   r*   r,   r   r   r   r/   k   s     zF$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure)r(   zunable to execute %r: %s
r   z(unable to execute %r for unknown reasonsr   r   z"command %r terminated by signal %dr   z1unknown error executing %r: termination status %d)#r   r   r    r   ÚexecvpÚexecvÚsysÚplatformÚ_cfg_targetÚ	distutilsr'   Zget_config_varÚsplitÚ_cfg_target_splitÚenvironÚgetr   ÚdictÚexecvpeÚexecveÚforkr#   r   ÚstderrÚwriteÚstrerrorÚ_exitÚwaitpidr   r   ÚWIFSIGNALEDÚWTERMSIGÚ	WIFEXITEDÚWEXITSTATUSÚ
WIFSTOPPED)r   r   r   r   r$   Zexec_fnÚenvr'   Z
cur_targetZmy_msgÚpidÚeZstatusr%   Zexit_statusr   r   r   r   W   s     
ÿÿþÿ
ÿÿÿÿ

ÿÿÿÿr   c              	   C   sÊ   t j | ¡\}}tjdkr*|dkr*| d } t j | ¡r:| S |dkr†t j dd¡}|dkr†zt  d¡}W n t	t
fk
r„   t j}Y nX |sŽdS | t j¡}|D ]&}t j || ¡}t j |¡rž|  S qždS )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.
    Zwin32z.exeNÚPATHÚCS_PATH)r   ÚpathÚsplitextr3   r4   Úisfiler9   r:   ÚconfstrÚAttributeErrorÚ
ValueErrorÚdefpathr7   Úpathsepr    )r$   rN   Ú_ZextÚpathsÚpÚfr   r   r   r   ©   s(    
r   )r   r   r   )r   r   r   )r   r   r   )N)Ú__doc__r3   r   Zdistutils.errorsr   r   Zdistutils.debugr   r6   r   r   r   r   r4   r5   r8   r   r   r   r   r   r   Ú<module>   s   



R