| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/ |
Upload File : |
a
X��e�# � @ sx d dl Z d dlZd dlZd dlZd dlmZmZmZmZm Z m
Z
mZmZ d dl
mZ d dlmZmZ d dlmZ d dlmZmZ d dlmZ er�d dlmZ e eeef Zeeeef ed �d
d�Zee e ef ed �dd
�Zee e ef e e d �dd�Zdee e ef eee deee ee
eef eee ee ee ee eed�dd�Z!eed d�dd�Z"dS )� N)�
TYPE_CHECKING�Any�Callable�Iterable�List�Mapping�Optional�Union)�escape)�SpinnerInterface�open_spinner)�InstallationSubprocessError)�VERBOSE�subprocess_logger)�
HiddenText)�Literal)�args�returnc G s2 g }| D ]$}t |t�r"|�|� q|�|� q|S )z&
Create a CommandArgs object.
)�
isinstance�list�extend�append)r Zcommand_args�arg� r �B/usr/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py�make_command s
r c C s d� dd� | D ��S )z/
Format command arguments for display.
� c s s0 | ](}t |t�rt�t|��nt�|�V qd S )N)r r �shlex�quote�str��.0r r r r � <genexpr>: s �z&format_command_args.<locals>.<genexpr>)�join�r r r r �format_command_args1 s
�r% c C s dd� | D �S )z=
Return the arguments in their raw, unredacted form.
c S s g | ]}t |t�r|jn|�qS r )r r Zsecretr r r r �
<listcomp>D � z'reveal_command_args.<locals>.<listcomp>r r$ r r r �reveal_command_args@ s r( F�raiseTz"Literal["raise", "warn", "ignore"])�cmd�show_stdout�cwd�
on_returncode�extra_ok_returncodes�
extra_environ�
unset_environ�spinner�log_failed_cmd�stdout_only�command_descr c
C s� |du rg }|du rg }|r*t j}tj}n
t j}t}t �� |k}
|
oL|du}|d|
� tj� � }|rp|�
|� |D ]}|�|d� qtz0tj
t| �tjtj| s�tjntj||dd�}W n8 ty� } z |r�t �d||
� � W Y d}~n
d}~0 0 g }| �s�|j�sJ �|j�sJ �|j�� |j�� }|�s0�qj|�� }|�|d � ||� |�r|�s^J �|�� �qz|�� W |j�r�|j�� n|j�r�|j�� 0 d�|�}nT|�� \}}|�� D ]}||� �q�|�|� |�� D ]}||� �q�|�|� |}|j�o|j|v}|�r<|�s J �|�r2|�d� n
|�d � |�r�|d
k�r�t |
|j|
�s^|ndd�}|�r�t j!d|d
did� t jdt"t#| ��ddid� t jdt"|�p�d�ddid� |�n8|dk�r�t �$d|
|j|� n|dk�r�nt%d|����|S )a�
Args:
show_stdout: if true, use INFO to log the subprocess's stderr and
stdout streams. Otherwise, use DEBUG. Defaults to False.
extra_ok_returncodes: an iterable of integer return codes that are
acceptable, in addition to 0. Defaults to None, which means [].
unset_environ: an iterable of environment variable names to unset
prior to calling subprocess.Popen().
log_failed_cmd: if false, failed commands are not logged, only raised.
stdout_only: if true, return only stdout, else return both. When true,
logging of both stdout and stderr occurs when the subprocess has
terminated, else logging occurs as subprocess output is produced.
NzRunning command %s�backslashreplace)�stdin�stdout�stderrr, �env�errorsz#Error %s while executing command %s�
� �errorZdoner) )Zcommand_descriptionZ exit_codeZoutput_linesz%sZrichT)Zextraz*[bold magenta]full command[/]: [blue]%s[/]Zmarkupz[bold magenta]cwd[/]: %sz [inherit]�warnz$Command "%s" had error code %s in %s�ignorezInvalid value: on_returncode=)&r �info�logging�INFO�verboser ZgetEffectiveLevel�os�environ�copy�update�pop�
subprocess�Popenr( �PIPEZSTDOUT� ExceptionZcriticalr7 r6 �close�readline�rstripr Zspin�waitr# Zcommunicate�
splitlines�
returncodeZfinishr
r= r
r% Zwarning�
ValueError)r* r+ r, r- r. r/ r0 r1 r2 r3 r4 Zlog_subprocessZ
used_levelZshowing_subprocessZuse_spinnerr9 �name�proc�excZ
all_output�line�output�out�errZout_lineZerr_lineZproc_had_errorr= r r r �call_subprocessG s�
�
�
�
�
��
�
r[ ).N)�messager c s2 dt t tt ttttf dd�� fdd�
}|S )z�Provide a subprocess_runner that shows a spinner message.
Intended for use with for BuildBackendHookCaller. Thus, the runner has
an API that matches what's expected by BuildBackendHookCaller.subprocess_runner.
N)r* r, r/ r c s>