o 6a5 @sdZddlZddlZddlZzddlmZWney%ddlmZYnwgdZGdddZGdddZ Gd d d Z ej d krHe Z dSej d krQe Z dSdS) zq Helper functions for interacting with the shell, and consuming shell-style parameters provided in config files. Nquote) WindowsParser PosixParser NativeParserc@(eZdZdZeddZeddZdS)CommandLineParsera  An object that knows how to split and join command-line arguments. It must be true that ``argv == split(join(argv))`` for all ``argv``. The reverse neednt be true - `join(split(cmd))` may result in the addition or removal of unnecessary escaping. cCt)z5 Join a list of arguments into a command line string NotImplementedErrorargvr>/usr/lib/python3/dist-packages/numpy/distutils/_shell_utils.pyjoinzCommandLineParser.joincCr )z6 Split a command line string into a list of arguments r cmdrrrsplitrzCommandLineParser.splitN__name__ __module__ __qualname____doc__ staticmethodrrrrrrrs  rc@r)rz The parsing behavior used by `subprocess.call("string")` on Windows, which matches the Microsoft C/C++ runtime. Note that this is _not_ the behavior of cmd. cCs t|SN) subprocess list2cmdliner rrrr*s zWindowsParser.joincsddl}z|jWn tytw|sgSd|}|jjj}||j|_|j||j f|_ | }||| |fddt |j D}|jjrRJ|ddksZJ|ddS)Nrzdummy csg|]}|qSrr).0ilpargsrr Csz'WindowsParser.split..dummy)ctypeswindllAttributeErrorr shell32CommandLineToArgvWPOINTER c_wchar_prestypec_intargtypesbyrefrangevaluekernel32 LocalFree)rr%r)nargsargsrr rr/s$    zWindowsParser.splitNrrrrrr#s  rc@r)rzX The parsing behavior used by `subprocess.call("string", shell=True)` on Posix. cCsddd|DS)N css|]}t|VqdSrr)rargrrr Qsz#PosixParser.join..)rr rrrrOszPosixParser.joincCstj|ddS)NT)posix)shlexrrrrrrSszPosixParser.splitNrrrrrrKs  rntr9) rosr:rr ImportErrorpipes__all__rrrnamerrrrrs$ (