%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.9/site-packages/numpy/distutils/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.9/site-packages/numpy/distutils/__pycache__/exec_command.cpython-39.opt-1.pyc

a

z[ycg(�@s�dZddgZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZdd�Zd	d
�Z
dd�Zd
d�Zdifdd�Zdd�Zdd�Zddd�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�dkrL|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�B/usr/lib64/python3.9/site-packages/numpy/distutils/exec_command.py�filepath_from_subprocess_output?s
rcCsZttjd�rtjj�|�n:ttjd�r@tj�|�tjj��ntj�|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(cCsBtj}tjdvr>tj�|�\}}|���dd�}tj�||�}|S)N)�nt�dosZPYTHONWZPYTHON)	r�
executable�osr'�path�split�upperr�join)Z	pythonexeZfdir�fnrrr�
get_pythonexeks
r2c
Csx||f}z
||WSty$Yn0t�d|�|}|durPtj�dtj�}tjdkrdtjj	}ndd�}|�
d�r�|dd	�}d
g}tjdvr�tj�|�\}}gd�}	|��|	vr�|	}tj�
|�r�d
g}
nd
d�|�tj�D�}
|
D]|}tj�||�}|D]d}||}tj�|��s ||�}tj�|��r�t�|tj��r�t�d|�|||<|S�q�q�t�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>��z!find_executable.<locals>.<lambda>�"rr
�)r)r*Zos2)z.exez.comz.batcSsg|]}tj�|��qSr)r,r-�abspath)�.0�prrr�
<listcomp>�r8z#find_executable.<locals>.<listcomp>zFound executable %szCould not locate executable %s)�KeyErrorr�debugr,�environ�get�defpathr'r-�realpath�
startswith�splitext�lower�isabsr.�pathsepr0�islink�isfile�access�X_OK�infor#)
Zexer-�_cache�keyZorig_exerD�suffixesr1�extZextra_suffixes�paths�sZf_extrrrrtsF




cCs t�d|�dd�|D�}|S)Nz_preserve_environment(%r)cSsi|]}|tj�|��qSr)r,rArB)r<r'rrr�
<dictcomp>�r8z)_preserve_environment.<locals>.<dictcomp>)rr@)�names�envrrr�_preserve_environment�srXcKs.t�d�|��D]\}}|p dtj|<qdS)Nz_update_environment(...)r:)rr@�itemsr,rA)rWr'�valuerrr�_update_environment�s
r[r:rc

Ks�tjdtdd�t�d|d�dd�|��D��f�|durHtjd	k}|durZtjd	k}tj	�
|�}tj	�
t���}td
d�dkr�tj	�
tj	�
t��}nDtj	�d�r�tj	�
d
�}n*tj	�
tjd�}tj	�|�r�tj	�
|�}||k�rt�|�t�d|�nt�d|�tt|����}tfi|��zJt|f||d�|��}	W||k�rlt�|�t�d|�tfi|��n2||k�r�t�|�t�d|�tfi|��0|	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 insteadrr zexec_command(%r,%s)�,cSsg|]}d|�qS)z%s=%rr)r<Zkvrrrr>�r8z exec_command.<locals>.<listcomp>Nr4i�rzexec_command.py�.rzNew cwd: %szRetaining cwd: %s)�	use_shell�use_teezRestored cwd to %s)r"r#r$rr@r0rYr,r'r-r;�getcwd�__name__�dirname�__file__rKr�argv�chdirrX�list�keysr[�
_exec_command)
�commandZ
execute_inr^r_Z_with_pythonrWZoldcwdZexec_dirZoldenv�strrrr�sR ��



��

�

c	KsD|durtjdk}|dur$tjdk}tjdkrj|rjtj�dd�}t|�rZ|dd�|�g}n
|d|g}d}n&tjdkr�t|�r�d�d	d
�|D��}|p�d}ztj|||tjtj	dd�}Wnt
y�YdS0|��\}}t�
d�}|dur�d
}|j|dd�}|�dd�}|dd�dk�r&|dd�}|�r:|�r:t|�|j|fS)z0
    Internal workhorse for exec_command().
    Nr4ZSHELLz/bin/shz-c� Fr)css|]}t|�VqdSr5)�
_quote_arg)r<�argrrr�	<genexpr>r8z _exec_command.<locals>.<genexpr>)�shellrWr�stderrZuniversal_newlines)�r:rrr	rrr
)r,r'rArBrr0�
subprocess�Popen�PIPEZSTDOUT�OSErrorZcommunicaterrrr�print�
returncode)	rir^r_rW�sh�proc�text�errrrrrrh�s@



�

rhcCsd|vrd|vrd|S|S)zB
    Quote the argument for safe use in a shell command line.
    r9rkz"%s"r)rmrrrrl2srl)r:NNr)NN)�__doc__�__all__r,rrrrr"Znumpy.distutils.misc_utilrrZnumpy.distutilsrrrr(r2rrXr[rrhrlrrrr�<module>s(3	3�
L
5

Zerion Mini Shell 1.0