§ y<ˆj+(ãó —dZddgZddlZddlZddlZddlZddlZddlmZm Z ddl m Z d„Z d„Z d „Zd „Zdifd „Zd „Zd „Z dd„Zdd„Zd„ZdS)a0 exec_command Implements exec_command function that is (almost) equivalent to commands.getstatusoutput function but on NT, DOS systems the returned status is actually correct (though, the returned status values may be different by a factor). In addition, exec_command takes keyword arguments for (re-)defining environment variables. Provides functions: exec_command --- execute command in a specified directory and in the modified environment. find_executable --- locate a command using info from environment variable PATH. Equivalent to posix `which` command. Author: Pearu Peterson Created: 11 January 2003 Requires: Python 2.x Successfully tested on: ======== ============ ================================================= os.name sys.platform comments ======== ============ ================================================= posix linux2 Debian (sid) Linux, Python 2.1.3+, 2.2.3+, 2.3.3 PyCrust 0.9.3, Idle 1.0.2 posix linux2 Red Hat 9 Linux, Python 2.1.3, 2.2.2, 2.3.2 posix sunos5 SunOS 5.9, Python 2.2, 2.3.2 posix darwin Darwin 7.2.0, Python 2.3 nt win32 Windows Me Python 2.3(EE), Idle 1.0, PyCrust 0.7.2 Python 2.1.1 Idle 0.8 nt win32 Windows 98, Python 2.1.1. Idle 0.8 nt win32 Cygwin 98-4.10, Python 2.1.1(MSC) - echo tests fail i.e. redefining environment variables may not work. FIXED: don't use cygwin echo! Comment: also `cmd /c echo` will not work but redefining environment variables do work. posix cygwin Cygwin 98-4.10, Python 2.3.3(cygming special) nt win32 Windows XP, Python 2.3.3 ======== ============ ================================================= Known bugs: * Tests, that send messages to stderr, fail when executed from MSYS prompt because the messages are lost at some point. Ú exec_commandÚfind_executableéN)Ú is_sequenceÚmake_temp_file)ÚlogcóÀ—tjd¦«}|€d}| |d¬¦«}| dd¦«}|dd…dkr |dd…}|S) zŸ Convert `bytes` in the encoding used by a subprocess into a filesystem-appropriate `str`. Inherited from `exec_command`, and possibly incorrect. FNÚasciiÚreplace©Úerrorsú ú éÿÿÿÿ)ÚlocaleÚgetpreferredencodingÚdecoder )ÚoutputÚmylocales úp/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib64/python3.11/site-packages/numpy/distutils/exec_command.pyÚfilepath_from_subprocess_outputr?sl€õ Ô*¨5Ñ1Ô1€HØÐØˆØ �]Š]˜8¨Iˆ]Ñ 6Ô 6€FØ �^Š^˜F DÑ )Ô )€Fà ˆbˆcˆc„{�dÒÐØ˜˜˜”ˆØ €Mócó¨—ttjd¦«r&tjj |¦«dSttjd¦«rCtj | tjj¦«¦«dStj | dd¬¦«¦«dS)zÈ Forward bytes from a subprocess call to the console, without attempting to decode them. The assumption is that the subprocess call already returned bytes in a suitable encoding. ÚbufferÚencodingÚutf8r r N)ÚhasattrÚsysÚstdoutrÚwriterr)Úvals rÚforward_bytes_to_stdoutr!Ps¦€õ�sŒz˜8Ñ$Ô$ð?å Œ Ô×Ò Ñ$Ô$Ð$Ð$Ð$Ý •”˜ZÑ (Ô (ð?å Œ ×Ò˜Ÿš¥C¤JÔ$7Ñ8Ô8Ñ9Ô9Ð9Ð9Ð9õ Œ ×Ò˜Ÿš F°9˜Ñ=Ô=Ñ>Ô>Ð>Ð>Ð>rcóˆ—tjdtd¬¦«t¦«\}}| ¦«|S)NzLtemp_file_name is deprecated since NumPy v1.17, use tempfile.mkstemp insteadé©Ú stacklevel)ÚwarningsÚwarnÚDeprecationWarningrÚclose)ÚfoÚnames rÚtemp_file_namer,csJ€å „Mð-Ý.@ÈQðPñPôPðPåÑÔ�H€BˆØ‡H‚H�J„J€JØ €Krcóf—tj}tjdvr–tj |¦«\}}| ¦« dd¦«}tj ||¦«}tj  |¦«s J|›d�¦«‚|S)N)ÚntÚdosÚPYTHONWÚPYTHONz is not a file) rÚ executableÚosr+ÚpathÚsplitÚupperr ÚjoinÚisfile)Ú pythonexeÚfdirÚfns rÚ get_pythonexer<ksŽ€Ý”€IÝ „w�-ÐÐÝ”7—=’= Ñ+Ô+‰ˆˆbØ �XŠX‰ZŒZ× Ò   ¨8Ñ 4Ô 4ˆÝ”G—L’L  rÑ*Ô*ˆ ÝŒw�~Š~˜iÑ(Ô(ÐKÐKÀ À À Ð*KÑKÔKÐ(Ø Ðrcó(—||f} ||S#t$rYnwxYwtjd|z¦«|}|€*tj dtj¦«}tjdkrtjj }nd„}|  d¦«r |dd…}d g}tjd vr>tj  |¦«\}}gd ¢} |  ¦«| vr| }tj  |¦«rd g} n)d „| tj¦«D¦«} | D]¶}tj ||¦«}|D]‘} || z} tj | ¦«s || ¦«} tj | ¦«rAtj| tj¦«r"tjd | z¦«| ||<| ccSŒ’Œ·tjd|z¦«dS)zTReturn full path of a executable or None. Symbolic links are not followed. zfind_executable(%r)NÚPATHÚposixcó—|S©N©)Úas rúz!find_executable..†s€˜A€rú"r#rÚ)r.r/Úos2)z.exez.comz.batcóL—g|]!}tj |¦«‘Œ"SrB)r3r4Úabspath)Ú.0Úps rú z#find_executable..•s&€ÐFÐFÐF¨•"”'—/’/ !Ñ$Ô$ÐFÐFÐFrzFound executable %szCould not locate executable %s)ÚKeyErrorrÚdebugr3ÚenvironÚgetÚdefpathr+r4ÚrealpathÚ startswithÚsplitextÚlowerÚisabsr5Úpathsepr7Úislinkr8ÚaccessÚX_OKÚinfor') Úexer4Ú_cacheÚkeyÚorig_exerRÚsuffixesr;ÚextÚextra_suffixesÚpathsÚsÚf_exts rrrts€ð ˆtˆ)€Cð Ø�cŒ{ÐøÝ ð ð ð Ø ˆð øøøå„IÐ# cÑ)Ñ*Ô*Ð*Ø€Hà €|ÝŒz�~Š~˜f¥b¤jÑ1Ô1ˆÝ „w�ÒÐÝ”7Ô#ˆˆà�:ˆà ‡~‚~�cÑÔðØ�!�B�$Œiˆàˆt€HÝ „wÐ&Ð&Ð&Ý”'×"Ò" 3Ñ'Ô'‰ˆˆCØ1Ð1Ð1ˆØ �9Š9‰;Œ;˜nÐ ,Ð ,Ø%ˆHå „w‡}‚}�SÑÔðGØ�ˆˆàFÐF¨d¯jªj½¼Ñ.DÔ.DÐFÑFÔFˆàð ð ˆÝ ŒW�\Š\˜$ Ñ $Ô $ˆØð ð ˆAØ�q‘DˆEÝ”7—>’> %Ñ(Ô(ð (Ø ˜ ™œ�ÝŒw�~Š~˜eÑ$Ô$ð ­¬°5½"¼'Ñ)BÔ)Bð Ý”Ð.°Ñ6Ñ7Ô7Ð7Ø#��s‘ Ø� � � � � øð õ„HÐ -°Ñ 8Ñ9Ô9Ð9Ø ˆ4s †Ž šcóL—tjd|z¦«d„|D¦«}|S)Nz_preserve_environment(%r)cóN—i|]"}|tj |¦«“Œ#SrB)r3rOrP)rJr+s rú z)_preserve_environment..©s(€Ð 8Ð 8Ð 8¨$ˆ4•”—’ Ñ%Ô%Ð 8Ð 8Ð 8r)rrN)ÚnamesÚenvs rÚ_preserve_environmentrk§s0€Ý„IÐ)¨UÑ3Ñ4Ô4Ð4Ø 8Ð 8°%Ð 8Ñ 8Ô 8€CØ €Jrc ó„—tjd¦«| ¦«D]\}}|pdtj|<ŒdS)Nz_update_environment(...)rF)rrNÚitemsr3rO)rjr+Úvalues rÚ_update_environmentro¬sK€Ý„IÐ(Ñ)Ô)Ð)Ø—y’y‘{”{ð'ð'‰ ˆˆeØ ˜; B�Œ �4ÑÐð'ð'rrFr#c óâ—tjdtd¬¦«tjd|›dd d„| ¦«D¦«¦«›d�¦«|€tjd k}|€tjd k}tj   |¦«}tj   tj ¦«¦«}td d…d krBtj   tj   t¦«¦«}n¬tj  d ¦«r tj   d ¦«}nmtj   t jd¦«}tj  |¦«rtj   |¦«}||kr,tj|¦«tjd|z¦«ntjd|z¦«t't)| ¦«¦«¦«}t-di|¤Ž t/|f||dœ|¤Ž} ||kr+tj|¦«tjd|z¦«t-di|¤ŽnB#||kr+tj|¦«tjd|z¦«t-di|¤ŽwxYw| S)aï Return (status,output) of executed command. .. deprecated:: 1.17 Use subprocess.Popen instead Parameters ---------- command : str A concatenated string of executable and arguments. execute_in : str Before running command ``cd execute_in`` and after ``cd -``. use_shell : {bool, None}, optional If True, execute ``sh -c command``. Default None (True) use_tee : {bool, None}, optional If True use tee. Default None (True) Returns ------- res : str Both stdout and stderr messages. Notes ----- On NT, DOS systems the returned status is correct for external commands. Wild cards will not work for non-posix systems or when use_shell=0. zJexec_command is deprecated since NumPy v1.17, use subprocess.Popen insteadr#r$z exec_command(ú,có—g|]}d|z‘ŒS)z%s=%rrB)rJÚkvs rrLz exec_command..Ôs€Ð4Ð4Ð4 "�7˜2‘:Ð4Ð4Ð4rú)Nr?iôÿÿÿrzexec_command.pyú.rz New cwd: %szRetaining cwd: %s)Ú use_shellÚuse_teezRestored cwd to %srB)r&r'r(rrNr7rmr3r+r4rIÚgetcwdÚ__name__ÚdirnameÚ__file__r8rÚargvÚchdirrkÚlistÚkeysroÚ _exec_command) ÚcommandÚ execute_inrvrwÚ _with_pythonrjÚoldcwdÚexec_dirÚoldenvÚsts rrr±sµ€õ@ „Mð-Ý.@ÈQðPñPôPðPå„I€I w w wØ �ŠÐ4Ð4¨¯ ª © ¬ Ð4Ñ4Ô4Ñ 5Ô 5Ð 5Ð 5ð7ñ8ô8ð8ð€Ý”'˜7Ò"ˆØÐÝ”G˜WÒ$ˆ Ý”—’ Ñ,Ô,€JÝ ŒW�_Š_�RœY™[œ[Ñ )Ô )€Få���„~˜Ò'Ð'Ý”7—?’?¥2¤7§?¢?µ8Ñ#<Ô#<Ñ=Ô=ˆˆÝ Œ�ŠÐ)Ñ *Ô *ð1Ý”7—?’? 3Ñ'Ô'ˆˆå”7—?’?¥3¤8¨A¤;Ñ/Ô/ˆÝ Œ7�>Š>˜(Ñ #Ô #ð 1Ý”w—’ xÑ0Ô0ˆHà ˆzÒÐÝ Œ�ÑÔÐÝ Œ �- *Ñ,Ñ-Ô-Ð-Ð-å Œ Ð%¨Ñ.Ñ/Ô/Ð/å "¥D¨¯ª©¬Ñ$4Ô$4Ñ 6Ô 6€FÝÐ Ð ˜3Ð Ð Ð ð &Ý ˜7ð"Ø%.Ø#*ð"ð"ð!ð"ð"ˆð �:Ò Ð Ý ŒH�VÑ Ô Ð Ý ŒIÐ*¨VÑ3Ñ 4Ô 4Ð 4ÝÐ%Ð%˜fÐ%Ð%Ð%Ð%øð �:Ò Ð Ý ŒH�VÑ Ô Ð Ý ŒIÐ*¨VÑ3Ñ 4Ô 4Ð 4ÝÐ%Ð%˜fÐ%Ð%Ð%Ð%øøøà €Is ÉJ-Ê-?K,c ó4—|€tjdk}|€tjdk}tjdkrR|rPtj dd¦«}t |¦«r|dd |¦«g}n|d|g}d}n>tjdkr.t |¦«rd d „|D¦«¦«}|pd} t j|||dt jt j ¬ ¦«}n#t$rYd SwxYw|  ¦«\}}tj d¦«}|€d }| |d ¬¦«}| dd¦«}|dd…dkr |dd…}|r|rt!|¦«|j|fS)z0 Internal workhorse for exec_command(). Nr?ÚSHELLz/bin/shz-cú Fr.c3ó4K—|]}t|¦«V—ŒdSrA)Ú _quote_arg)rJÚargs rú z _exec_command..s(èè€Ð>Ð>¨s�: c™?œ?Ð>Ð>Ð>Ð>Ð>Ð>r)ÚshellrjÚtextrÚstderr)érFr r r r rr)r3r+rOrPrr7Ú subprocessÚPopenÚPIPEÚSTDOUTÚOSErrorÚ communicaterrrr ÚprintÚ returncode) r�rvrwrjÚshÚprocr�Úerrrs rr€r€ýsÇ€ðÐÝ”G˜WÒ$ˆ ؀ݔ'˜7Ò"ˆå „w�'ÒИiÐå ŒZ�^Š^˜G YÑ /Ô /ˆÝ �wÑ Ô ð *ؘ4 §¢¨'Ñ!2Ô!2Ð3ˆGˆGà˜4 Ð)ˆG؈ ˆ å Œ�DŠˆ�[¨Ñ1Ô1ˆð—(’(Ð>Ð>°gÐ>Ñ>Ô>Ñ>Ô>ˆð ˆ+�€Cð õ Ô ¨y¸cÈÝ'1¤Ý'1Ô'8ð:ñ:ô:ˆˆøõ ðððàˆwˆwðøøøð× Ò Ñ"Ô"�I€Dˆ#ÝÔ*¨5Ñ1Ô1€HØÐØˆØ �;Š;�x¨ ˆ;Ñ 2Ô 2€DØ �<Š<˜ Ñ %Ô %€Dà ˆBˆCˆC„y�DÒÐØ�C�R�CŒyˆàð�4ðÝ ˆd‰ Œ ˆ Ø Œ?˜DÐ Ð sà .C9Ã9 DÄDcó —d|vr d|vrd|zS|S)zB Quote the argument for safe use in a shell command line. rErŠz"%s"rB)r�s rrŒrŒ1s$€ð  �#€~€~˜# ˜*˜*ؘ‰|ÐØ €Jr)rFNNr#)NN)Ú__doc__Ú__all__r3rr“rr&Únumpy.distutils.misc_utilrrÚnumpy.distutilsrrr!r,r<rrkrorr€rŒrBrrúr£s>ðð2ð2ðf Ð,Ð -€à € € € Ø € € € ØÐÐÐØ € € € Ø€€€àAÐAÐAÐAÐAÐAÐAÐAØÐÐÐÐÐðððð"?ð?ð?ð&ðððððð#¨2ð/ð/ð/ð/ðfððð 'ð'ð'ð BFØ !ðIðIðIðIðX1!ð1!ð1!ð1!ðhððððr