_d TdZddlZddlZddlZddlmZddlmZddlm Z d dZ d dZ y) 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)DistutilsExecError)DEBUG)logclt|}tjtj||ry|rt |d}|||d<||nt tj}tjdk(rddl m }m }|}|r|||< tj||} | j| j } | r&t$s|d}t'dj)|| y#t"$r9} t$s|d}t'dj)|| j*d| d} ~ wwxYw) aRun 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. Nrdarwin)MACOSX_VERSION_VARget_macosx_target_ver)envzcommand {!r} failed: {}z%command {!r} failed with exit code {})listrinfo subprocess list2cmdlinefind_executabledictosenvironsysplatformdistutils.utilr r Popenwait returncodeOSErrorrrformatargs) cmd search_pathverbosedry_runr executabler r macosx_target_verprocexitcodeexcs =/usr/lib/python3/dist-packages/setuptools/_distutils/spawn.pyspawnr(s&$ s)CHHZ $ $S )*$SV,  !CF#d2::&6C ||xL13 &7C" # - ??a&C 3 : :3 I   a&C % , ,S#((2, ?  s3C11 D3:4D..D3cZtjj|\}}tjdk(r |dk7r|dz}tjj |r|S|8tj jdd}| tjd}|sy|jtj}|D]E}tjj||}tjj |sC|cSy#ttf$rtj}YwxYw)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. win32z.exeNPATHCS_PATH)rpathsplitextrrisfilergetconfstrAttributeError ValueErrordefpathsplitpathsepjoin)r"r-_extpathspfs r'rrKs WW  j )FAs cVm&(  ww~~j! |zz~~fd+ < "zz),  JJrzz "E  GGLLJ ' 77>>! H  !#J/ "zz "sDD*)D*)rrrN)N) __doc__rrrerrorsrdebugr_logrr(rr'rCs) &6 r"rB