509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3

  \  ã               @   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rvddlmZ d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   ú'/usr/lib64/python3.6/distutils/spawn.pyÚspawn   s    

r   c             C   s.   x(t | ƒD ]\}}d|kr
d| | |< q
W | 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jdj|g| dd …  ƒƒ |s¸ytjtj|| ƒ}W n@ tk
r– } z$t	sp|} t
d| |jd f ƒ‚W Y d d }~X nX |dkr¸t	s¨|} t
d| |f ƒ‚d S )Nr   r   r   zcommand %r failed: %sz%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   Údarwin)Ú	sysconfigc             C   sx  t jdj| ƒƒ |rd S | d }|r*tjp.tj}d }tjdkrÈtd krlt	j
dƒpRdatrldd„ tjdƒD ƒatrÈtjjdtƒ}td	d„ |jdƒD ƒkrªd
|tf }t|ƒ‚ttj|d�}|rÂtjpÆtj}tjƒ }	|	dk�rvy$|d krð||| ƒ n||| |ƒ W nN tk
�rL }
 z0t�s|} tjjd| |
jf ƒ tjdƒ W Y d d }
~
X nX t�sX|} tjjd|  ƒ tjdƒ � nþ� xúytj|	dƒ\}	}W nD tk
�rÒ } z&t�s¬|} td| |jd f ƒ‚W Y d d }~X nX tj|ƒ�rt�sê|} td| tj|ƒf ƒ‚nltj|ƒ�rBtj |ƒ}|dk�r&d S t�s0|} td| |f ƒ‚n,tj!|ƒ�rT�qznt�s^|} td| |f ƒ‚�qzW d S )Nr   r   r$   Ú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   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 reasonszcommand %r failed: %sz"command %r terminated by signal %dz%command %r failed with exit status %dz1unknown error executing %r: termination status %dr   )"r   r   r   r   ÚexecvpÚexecvÚsysÚplatformÚ_cfg_targetr%   Ú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ÚenvZ
cur_targetZmy_msgÚpidÚeZstatusr#   Zexit_statusr   r   r   r   X   s†    



&

r   c             C   s’   |dkrt jjdt jƒ}|jt jƒ}t jj| ƒ\}}tj	dkrN|dkrN| d } t jj
| ƒsŠx*|D ]"}t jj|| ƒ}t jj
|ƒr`|S q`W dS | S 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.
    NÚPATHZwin32z.exe)r   r5   r6   Údefpathr3   ÚpathsepÚpathÚsplitextr/   r0   Úisfiler   )r"   rK   ÚpathsÚbaseZextÚpÚfr   r   r   r   ©   s    
r   )r   r   r   )r   r   r   )r   r   r   )N)Ú__doc__r/   r   Zdistutils.errorsr   r   Zdistutils.debugr   Z	distutilsr   r   r   r   r0   r%   r1   r4   r   r   r   r   r   r   Ú<module>   s   



Q