;ò
�ü?c           @   sœ   d  Z  d Z d k Z d k Z d k Z d k Td k l Z d d d d „ Z d „  Z	 d d d d	 „ Z
 d d d d
 „ Z d d d d „ Z e d „ Z d S(   sì   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.
s8   $Id: spawn.py,v 1.16 2002/11/21 20:41:07 akuchling Exp $N(   s   *(   s   logi   i    c         C   s‰   t  i d j o t |  | d | ƒn_ t  i d j o t |  | d | ƒn8 t  i d j o t |  | d | ƒn t d t  i ‚ d S(   s�  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.
    s   posixs   dry_runs   nts   os2s1   don't know how to spawn programs on platform '%s'N(	   s   oss   names   _spawn_posixs   cmds   search_paths   dry_runs	   _spawn_nts
   _spawn_os2s   DistutilsPlatformError(   s   cmds   search_paths   verboses   dry_run(    (    s,   /mit/python/lib/python2.3/distutils/spawn.pys   spawn   s     c         C   sX   xM t  t |  ƒ ƒ D]9 } t i |  | d ƒ d j o d |  | |  | <q q W|  Sd S(   s©   Quote command-line arguments for DOS/Windows conventions: just
    wraps every argument which contains blanks in double quotes, and
    returns a new argument list.
    s    iÿÿÿÿs   "%s"N(   s   ranges   lens   argss   is   strings   find(   s   argss   i(    (    s,   /mit/python/lib/python2.3/distutils/spawn.pys   _nt_quote_args1   s      c         C   sß   |  d } t |  ƒ }  | o t | ƒ p | } n t i t i | g |  d d ƒ ƒ | o{ y t
 i t
 i | |  ƒ } Wn0 t j
 o$ } t d |  d | d f ‚ n X| d j o t d |  d | f ‚ qÛ n d  S(   Ni    i   s    s   command '%s' failed: %siÿÿÿÿs'   command '%s' failed with exit status %d(   s   cmds
   executables   _nt_quote_argss   search_paths   find_executables   logs   infos   strings   joins   dry_runs   oss   spawnvs   P_WAITs   rcs   OSErrors   excs   DistutilsExecError(   s   cmds   search_paths   verboses   dry_runs
   executables   rcs   exc(    (    s,   /mit/python/lib/python2.3/distutils/spawn.pys	   _spawn_ntB   s    
$ c         C   sæ   |  d } | o t | ƒ p | } n t i t i | g |  d d ƒ ƒ | oŽ y t	 i
 t	 i | |  ƒ } Wn0 t j
 o$ } t d |  d | d f ‚ n X| d j o. d |  d | f GHt d |  d | f ‚ qâ n d  S(   Ni    i   s    s   command '%s' failed: %siÿÿÿÿs'   command '%s' failed with exit status %d(   s   cmds
   executables   search_paths   find_executables   logs   infos   strings   joins   dry_runs   oss   spawnvs   P_WAITs   rcs   OSErrors   excs   DistutilsExecError(   s   cmds   search_paths   verboses   dry_runs
   executables   rcs   exc(    (    s,   /mit/python/lib/python2.3/distutils/spawn.pys
   _spawn_os2[   s    
$ c   	      C   s»  t  i t i |  d ƒ ƒ | o d  Sn | o t i p t i	 } t i ƒ  } | d j o„ y | |  d |  ƒ WnC t j
 o7 } t i i d |  d | i f ƒ t i d ƒ n Xt i i d |  d ƒ t i d ƒ nÙ xÕ n oÍ t i | d ƒ \ } } t i | ƒ o$ t d |  d t i | ƒ f ‚ qâ t i | ƒ o? t i | ƒ } | d j o d  Sq²t d |  d | f ‚ qâ t i | ƒ o qé qâ t d |  d | f ‚ qé Wd  S(	   Ns    i    s   unable to execute %s: %s
i   s(   unable to execute %s for unknown reasonss$   command '%s' terminated by signal %ds'   command '%s' failed with exit status %ds3   unknown error executing '%s': termination status %d(   s   logs   infos   strings   joins   cmds   dry_runs   search_paths   oss   execvps   execvs   exec_fns   forks   pids   OSErrors   es   syss   stderrs   writes   strerrors   _exits   waitpids   statuss   WIFSIGNALEDs   DistutilsExecErrors   WTERMSIGs	   WIFEXITEDs   WEXITSTATUSs   exit_statuss
   WIFSTOPPED(	   s   cmds   search_paths   verboses   dry_runs   statuss   pids   exit_statuss   es   exec_fn(    (    s,   /mit/python/lib/python2.3/distutils/spawn.pys   _spawn_posixu   s4    ! $c         C   së   | t j o t i d } n t i | t i ƒ } t i  i |  ƒ \ } } t i d j p t i d j o
 | d j o |  d }  n t i  i |  ƒ oI x> | D]6 } t i  i | |  ƒ } t i  i | ƒ o | Sq¡ q¡ Wt Sn |  Sd S(   sÜ   Try 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.
    s   PATHs   win32s   os2s   .exeN(   s   paths   Nones   oss   environs   strings   splits   pathseps   pathss   splitexts
   executables   bases   exts   syss   platforms   names   isfiles   ps   joins   f(   s
   executables   paths   pathss   fs   ps   exts   base(    (    s,   /mit/python/lib/python2.3/distutils/spawn.pys   find_executable¬   s     - (   s   __doc__s   __revision__s   syss   oss   strings   distutils.errorss	   distutilss   logs   spawns   _nt_quote_argss	   _spawn_nts
   _spawn_os2s   _spawn_posixs   Nones   find_executable(   s   spawns   __revision__s	   _spawn_nts   strings   _nt_quote_argss   _spawn_posixs   syss   find_executables
   _spawn_os2s   oss   log(    (    s,   /mit/python/lib/python2.3/distutils/spawn.pys   ?   s    	7