HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pip/_internal/utils/__pycache__/subprocess.cpython-310.pyc
o

@%Ne�#�@s�ddlZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZddl
mZddlmZmZddlmZddlmZmZddlmZerNddlmZe	eeefZd	eeeefd
efdd�Zd	ee	eefd
efd
d�Zd	ee	eefd
e	efdd�Z									d&dee	eefdedeedddeee dee
eefdeeedeedeedeeded
efd d!�Z!d"ed
ed#fd$d%�Z"dS)'�N)�
TYPE_CHECKING�Any�Callable�Iterable�List�Mapping�Optional�Union)�escape)�SpinnerInterface�open_spinner)�InstallationSubprocessError)�VERBOSE�subprocess_logger)�
HiddenText)�Literal�args�returncGs2g}|D]}t|t�r|�|�q|�|�q|S)z&
    Create a CommandArgs object.
    )�
isinstance�list�extend�append)r�command_args�arg�r�@/usr/lib/python3/dist-packages/pip/_internal/utils/subprocess.py�make_command s
rcCsd�dd�|D��S)z/
    Format command arguments for display.
    � css2�|]}t|t�rt�t|��nt�|�VqdS)N)rr�shlex�quote�str��.0rrrr�	<genexpr>:s
� �
�z&format_command_args.<locals>.<genexpr>)�join�rrrr�format_command_args1s
	�r&cCsdd�|D�S)z=
    Return the arguments in their raw, unredacted form.
    cSs g|]}t|t�r|jn|�qSr)rr�secretr!rrr�
<listcomp>Ds z'reveal_command_args.<locals>.<listcomp>rr%rrr�reveal_command_args@sr)F�raiseT�cmd�show_stdout�cwd�
on_returncodez"Literal["raise", "warn", "ignore"]�extra_ok_returncodes�
extra_environ�
unset_environ�spinner�log_failed_cmd�stdout_only�command_descc

Cs�|durg}|durg}|rtj}tj}ntj}t}t��|k}
|
o&|du}|d|
�tj�	�}|r8|�
|�|D]}|�|d�q:ztj
t|�tjtj|	sRtjntj||dd�}Wntyq}z
|rlt�d||
��d}~wwg}|	s�|js{J�|js�J�|j��	|j��}|s�n|��}|�|d�||�|r�|s�J�|��q�z|��W|jr�|j��n
|jr�|j��wwd�|�}n(|��\}}|��D]}||�q�|�|�|��D]}||�q�|�|�|}|jo�|j|v}|�r|s�J�|�r|�d	�n|�d
�|�rh|dk�rIt |
|j|
�s|ndd�}|�rGt�!d
|�tjdt"t#|��ddid�tjdt"|�p@d�ddid�|�|dk�rYt�$d|
|j|�|S|dk�ra	|St%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 %sT�
��error�doner*)�command_description�	exit_code�output_linesz[present-diagnostic] %sz*[bold magenta]full command[/]: [blue]%s[/]�markup)�extraz[bold magenta]cwd[/]: %sz	[inherit]�warnz$Command "%s" had error code %s in %s�ignorezInvalid value: on_returncode=)&r�info�logging�INFO�verboser�getEffectiveLevel�os�environ�copy�update�pop�
subprocess�Popenr)�PIPE�STDOUT�	Exception�criticalr8r7�close�readline�rstripr�spin�waitr$�communicate�
splitlines�
returncode�finishr
r>r
r&�warning�
ValueError)r+r,r-r.r/r0r1r2r3r4r5�log_subprocess�
used_level�showing_subprocess�use_spinnerr:�name�proc�exc�
all_output�line�output�out�err�out_line�err_line�proc_had_errorr>rrr�call_subprocessGs�



�
���



�

���





�
��
�

��rq�message).Nc
s<		ddttdttdttttfddf�fdd�
}|S)	z�Provide a subprocess_runner that shows a spinner message.

    Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
    an API that matches what's expected by Pep517HookCaller.subprocess_runner.
    Nr+r-r0rcs@t���}t|�|||d�Wd�dS1swYdS)N)r5r-r0r2)rrq)r+r-r0r2�rrrr�runner�s
�"�z+runner_with_spinner_message.<locals>.runner)NN)rr rrr)rrrtrrsr�runner_with_spinner_message�s	�����ru)	FNr*NNNNTF)#rHrLrrQ�typingrrrrrrrr	�pip._vendor.rich.markupr
�pip._internal.cli.spinnersrr�pip._internal.exceptionsr
�pip._internal.utils.loggingrr�pip._internal.utils.miscrrr �CommandArgsrr&r)�bool�intrqrurrrr�<module>sh("	�����
��
��	�
��
�)