HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc
a

g��e;'�
@s�ddlZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZddlm
Z
mZddlmZddlmZmZddlmZeeeefZdZdd	�Zd
d�Zdd
�Zdd�Zddd�Zdd�ZdS)�N)�Any�Callable�Iterable�List�Mapping�Optional�Union)�SpinnerInterface�open_spinner)�InstallationSubprocessError)�VERBOSE�subprocess_logger)�
HiddenTextz(----------------------------------------cGs2g}|D]$}t|t�r"|�|�q|�|�q|S)z&
    Create a CommandArgs object.
    )�
isinstance�list�extend�append)�argsZcommand_args�arg�r�B/usr/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py�make_commands
rcCsd�dd�|D��S)z/
    Format command arguments for display.
    � css0|](}t|t�rt�t|��nt�|�VqdS)N)rr�shlex�quote�str��.0rrrr�	<genexpr>.s�z&format_command_args.<locals>.<genexpr>)�join�rrrr�format_command_args$s

�r!cCsdd�|D�S)z=
    Return the arguments in their raw, unredacted form.
    cSs g|]}t|t�r|jn|�qSr)rrZsecretrrrr�
<listcomp>9�z'reveal_command_args.<locals>.<listcomp>rr rrr�reveal_command_args4sr$cCs0t|�}d�|�}dj|||t|�|td�}|S)z�
    Create and return the error message to use to log a subprocess error
    with command output.

    :param lines: A list of lines, each ending with a newline.
    �z�Command errored out with exit status {exit_status}:
 command: {command_display}
     cwd: {cwd_display}
Complete output ({line_count} lines):
{output}{divider})�exit_statusZcommand_displayZcwd_displayZ
line_count�outputZdivider)r!r�format�len�LOG_DIVIDER)�cmd_args�cwd�linesr&Zcommandr'�msgrrr�make_subprocess_output_error<s

�	�r/F�raiseTc
Cs�|durg}|durg}|r*tj}tj}n
tj}t}t��|k}
|
oL|du}|dur^t|�}|d|�tj	�
�}|r�|�|�|D]}|�|d�q�z0t
jt|�t
jt
j|
s�t
jnt
j||dd�}Wn8ty�}z |	r�t�d||��WYd}~n
d}~00g}|
�s�|j�sJ�|j�s"J�|j��|j��}|�s@�qz|��}|�|d�||�|�r,|�snJ�|���q,z|��W|j�r�|j��n|j�r�|j��0d�|�}nT|��\}}|��D]}||��q�|�|�|��D]}||��q�|�|�|}|j�o|j|v}|�rL|�s0J�|�rB|� d�n
|� d	�|�r�|d
k�r�|
�s�|	�r�t!||||jd�}t�"|�t#|j|��n8|dk�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�
r%�errorZdoner0)r+r,r-r&�warnz$Command "%s" had error code %s in %s�ignorezInvalid value: on_returncode=)&r
�info�logging�INFO�verboserZgetEffectiveLevelr!�os�environ�copy�update�pop�
subprocess�Popenr$�PIPEZSTDOUT�	ExceptionZcriticalr3r2�close�readline�rstriprZspin�waitrZcommunicate�
splitlines�
returncodeZfinishr/r8rZwarning�
ValueError)�cmdZshow_stdoutr,Z
on_returncodeZextra_ok_returncodesZcommand_desc�
extra_environZ
unset_environ�spinnerZlog_failed_cmdZstdout_onlyZlog_subprocessZ
used_levelZshowing_subprocessZuse_spinnerr5�name�proc�excZ
all_output�liner'�out�errZout_lineZerr_lineZproc_had_errorr.rrr�call_subprocess`s�


�

�



�




�

�
rXcsd�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.
    Ncs<t��� }t||||d�Wd�n1s.0YdS)N)r,rPrQ)r
rX)rOr,rPrQ��messagerr�runners
�z+runner_with_spinner_message.<locals>.runner)NNr)rZr[rrYr�runner_with_spinner_messages
�r\)
FNr0NNNNNTF)r<r?rrD�typingrrrrrrrZpip._internal.cli.spinnersr	r
Zpip._internal.exceptionsrZpip._internal.utils.loggingrr
Zpip._internal.utils.miscrrZCommandArgsr*rr!r$r/rXr\rrrr�<module>s6$&�
$