a :jg @spdZddlZddlZddlZgdZGdddZGdddZGdd d Zejd kr^eZ nejd krleZ dS) zq Helper functions for interacting with the shell, and consuming shell-style parameters provided in config files. N) WindowsParser PosixParser NativeParserc@s(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. cCstdS)z5 Join a list of arguments into a command line string NNotImplementedErrorargvr F/usr/local/lib/python3.9/site-packages/numpy/distutils/_shell_utils.pyjoinszCommandLineParser.joincCstdS)z6 Split a command line string into a list of arguments Nrcmdr r r splitszCommandLineParser.splitN__name__ __module__ __qualname____doc__ staticmethodr rr r r r r s  rc@s(eZdZdZeddZeddZdS)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 list2cmdlinerr r r r &szWindowsParser.joincsddl}z |jWnty(tYn0|s2gSd|}|jjj}||j|_|j||j f|_ | }||| |fddt |j D}|jjrJ|ddksJ|ddS)Nrzdummy csg|] }|qSr r ).0iZlpargsr r ?z'WindowsParser.split..dummy)ctypesZwindllAttributeErrorrZshell32CommandLineToArgvWZPOINTERZ c_wchar_prestypeZc_intargtypesZbyrefrangevalueZkernel32Z LocalFree)rr r"nargsargsr rr r+s"    zWindowsParser.splitNrr r r r rs  rc@s(eZdZdZeddZeddZdS)rzX The parsing behavior used by `subprocess.call("string", shell=True)` on Posix. cCsddd|DS)N css|]}t|VqdSr)shlexquote)rargr r r Mrz#PosixParser.join..)r rr r r r KszPosixParser.joincCstj|ddS)NT)posix)r*rr r r r rOszPosixParser.splitNrr r r r rGs  rntr.) rosr*r__all__rrrnamerr r r r s(