https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/numpy/distutils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/numpy/distutils/__pycache__/exec_command.cpython-310.pyc
o

6��ap(�@s�dZddgZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZdd�Zd	d
�Z
dd�Zd
d�Zdifdd�Zdd�Zdd�Z		ddd�Zddd�Zdd�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 <pearu@cens.ioc.ee>
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)�logcCsPt�d�}|durd}|j|dd�}|�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�mylocale�r�>/usr/lib/python3/dist-packages/numpy/distutils/exec_command.py�filepath_from_subprocess_output?s
rcCs^ttjd�rtjj�|�dSttjd�r"tj�|�tjj��dStj�|jddd��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�utf8rr	N)�hasattr�sys�stdoutr�writerr)�valrrr�forward_bytes_to_stdoutPs
rcCs&tjdtdd�t�\}}|��|S)NzLtemp_file_name is deprecated since NumPy v1.17, use tempfile.mkstemp instead���
stacklevel)�warnings�warn�DeprecationWarningr�close)�fo�namerrr�temp_file_namecs�
r(cCs\tj}tjdvr,tj�|�\}}|���dd�}tj�||�}tj�	|�s,Jd|f��|S)N)�nt�dos�PYTHONW�PYTHONz%r is not a file)
r�
executable�osr'�path�split�upperr�join�isfile)�	pythonexe�fdir�fnrrr�
get_pythonexeks
r7c
Csp||f}z||WStyYnwt�d|�|}|dur(tj�dtj�}tjdkr2tjj	}ndd�}|�
d�rA|dd	�}d
g}tjdvr]tj�|�\}}gd�}	|��|	vr]|	}tj�
|�rgd
g}
nd
d�|�tj�D�}
|
D]:}tj�||�}|D].}||}tj�|�s�||�}tj�|�r�t�|tj�r�t�d|�|||<|Sqqtt�d|�dS)zTReturn full path of a executable or None.

    Symbolic links are not followed.
    zfind_executable(%r)N�PATH�posixcSs|S�Nr)�arrr�<lambda>�sz!find_executable.<locals>.<lambda>�"rr
�)r)r*�os2)z.exez.comz.batcSsg|]}tj�|��qSr)r.r/�abspath)�.0�prrr�
<listcomp>�sz#find_executable.<locals>.<listcomp>zFound executable %szCould not locate executable %s)�KeyErrorr�debugr.�environ�get�defpathr'r/�realpath�
startswith�splitext�lower�isabsr0�pathsepr2�islinkr3�access�X_OK�infor#)
�exer/�_cache�key�orig_exerI�suffixesr6�ext�extra_suffixes�paths�s�f_extrrrrtsL
�



��	cCs t�d|�dd�|D�}|S)Nz_preserve_environment(%r)cSsi|]	}|tj�|��qSr)r.rFrG)rAr'rrr�
<dictcomp>�sz)_preserve_environment.<locals>.<dictcomp>)rrE)�names�envrrr�_preserve_environment�sr`cKs.t�d�|��D]\}}|pdtj|<q	dS)Nz_update_environment(...)r>)rrE�itemsr.rF)r_r'�valuerrr�_update_environment�s
�rcr>rc

Ks�tjdtdd�t�d|d�dd�|��D��f�|dur$tjd	k}|dur-tjd	k}tj	�
|�}tj	�
t���}td
d�dkrNtj	�
tj	�
t��}n"tj	�d�r[tj	�
d
�}ntj	�
tjd�}tj	�|�rptj	�
|�}||kr�t�|�t�d|�nt�d|�tt|����}tdi|��z%t|f||d�|��}	W||kr�t�|�t�d|�tdi|��|	S||kr�t�|�t�d|�tdi|��w)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 insteadrr zexec_command(%r,%s)�,cSsg|]}d|�qS)z%s=%rr)rA�kvrrrrC�sz exec_command.<locals>.<listcomp>Nr9i�rzexec_command.py�.rzNew cwd: %szRetaining cwd: %s)�	use_shell�use_teezRestored cwd to %sr)r"r#r$rrEr2rar.r'r/r@�getcwd�__name__�dirname�__file__r3r�argv�chdirr`�list�keysrc�
_exec_command)
�command�
execute_inrgrh�_with_pythonr_�oldcwd�exec_dir�oldenv�strrrr�sR ��


��
�
c	Ks>|dur	tjdk}|durtjdk}tjdkr5|r5tj�dd�}t|�r-|dd�|�g}n|d|g}d}ntjdkrHt|�rHd�d	d
�|D��}|pKd}ztj|||tjtj	dd�}Wn
t
yeYdSw|��\}}t�
d�}|durwd
}|j|dd�}|�dd�}|dd�dkr�|dd�}|r�|r�t|�|j|fS)z0
    Internal workhorse for exec_command().
    Nr9�SHELLz/bin/shz-c� Fr)css�|]}t|�VqdSr:)�
_quote_arg)rA�argrrr�	<genexpr>s�z _exec_command.<locals>.<genexpr>)�shellr_r�stderr�universal_newlines)�r>rrr	rrr
)r.r'rFrGrr2�
subprocess�Popen�PIPE�STDOUT�EnvironmentError�communicaterrrr�print�
returncode)	rrrgrhr_�sh�proc�text�errrrrrrq�sB




��

rqcCsd|vrd|vrd|S|S)zB
    Quote the argument for safe use in a shell command line.
    r=rzz"%s"r)r|rrrr{2sr{)r>NNr)NN)�__doc__�__all__r.rr�rr"�numpy.distutils.misc_utilrr�numpy.distutilsrrrr(r7rr`rcrrqr{rrrr�<module>s*3	3
�
L5

https://t.me/RX1948 - 2025