o
aiJ' @ s d dl Z d dlZd dlZd dlZd dlmZmZmZmZm Z m
Z
mZmZ d dl
mZmZ d dlmZ d dlmZmZ d dlmZ erHd dlmZ e eeef ZdZd eeeef d
efddZd ee e ef d
efd
dZd ee e ef d
e e fddZdee e ef dee de e ded
ef
ddZ d+dee e ef de dee dddeee dee d ee
eef d!eee d"ee d#ee d$ee d
efd%d&Z!d'ed
ed( fd)d*Z"dS ), N)
TYPE_CHECKINGAnyCallableIterableListMappingOptionalUnion)SpinnerInterfaceopen_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger)
HiddenText)Literalz(----------------------------------------argsreturnc G s2 g }| D ]}t |tr|| q|| q|S )z&
Create a CommandArgs object.
)
isinstancelistextendappend)r command_argsarg r /builddir/build/BUILDROOT/alt-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/utils/subprocess.pymake_command! s
r c C s d dd | D S )z/
Format command arguments for display.
c s s2 | ]}t |trtt|nt|V qd S )N)r r shlexquotestr.0r r r r ; s
z&format_command_args..)joinr r r r format_command_args2 s
r% c C s dd | D S )z=
Return the arguments in their raw, unredacted form.
c S s g | ]}t |tr|jn|qS r )r r secretr r r r
E s z'reveal_command_args..r r$ r r r reveal_command_argsA s r( cmd_argscwdlinesexit_statusc C s0 t | }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.
zCommand errored out with exit status {exit_status}:
command: {command_display}
cwd: {cwd_display}
Complete output ({line_count} lines):
{output}{divider})r, command_displaycwd_display
line_countoutputdivider)r% r# formatlenLOG_DIVIDER)r) r* r+ r, commandr1 msgr r r make_subprocess_output_errorH s
r8 FraiseTcmdshow_stdout
on_returncodez"Literal["raise", "warn", "ignore"]extra_ok_returncodescommand_desc
extra_environ
unset_environspinnerlog_failed_cmdstdout_onlyc
C s |du rg }|du rg }|rt j}tj}nt j}t}t |k}
|
o&|du}|du r/t| }|d| tj
}|r@|| |D ]}||d qBzt
jt| t
jt
j|
sZt
jnt
j||dd}W n tyy } z
| rtt d|| d}~ww g }|
s|jsJ |jsJ |j |j }|sn| }||d || |r|sJ | qz| W |jr|j n
|jr|j w w d|}n(| \}}| D ]}|| q|| | D ]}|| q|| |}|jo|j|v}|r|sJ |r| d n| d
|rV|dkr7|
s1| r1t!| |||jd}t "| t#|j||d
krGt $d||j| |S |dkrO |S t%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 %sbackslashreplace)stdinstdoutstderrr* enverrorsz#Error %s while executing command %sT
r- errordoner9 )r) r* r+ r, warnz$Command "%s" had error code %s in %signorezInvalid value: on_returncode=)&r infologgingINFOverboser
getEffectiveLevelr% osenvironcopyupdatepop
subprocessPopenr( PIPESTDOUT ExceptioncriticalrF rE closereadlinerstripr spinwaitr# communicate
splitlines
returncodefinishr8 rK r warning
ValueError)r: r; r* r<