U 巀g#@shddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z m Z ddl mZddlmZmZddlmZddlmZmZddlmZee eefZe eeefedd d Ze eeefedd d Ze eeefeedd dZde eeefee ede eee e eefe eee ee ee eeed ddZ eeddddZ!dS)N)AnyCallableIterableListLiteralMappingOptionalUnion)escape)SpinnerInterface open_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger) HiddenText)argsreturncGs2g}|D]$}t|tr"||q||q|S)z& Create a CommandArgs object. ) isinstancelistextendappend)r command_argsargrL/opt/hc_python/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py make_commands    rcCsddd|DS)z/ Format command arguments for display.  css0|](}t|trtt|nt|VqdS)N)rrshlexquotestr.0rrrr +sz&format_command_args..)joinrrrrformat_command_args"s r%cCsdd|DS)z= Return the arguments in their raw, unredacted form. cSs g|]}t|tr|jn|qSr)rrsecretr rrr 5sz'reveal_command_args..rr$rrrreveal_command_args1sr(FraiseTz"Literal["raise", "warn", "ignore"]) cmd show_stdoutcwd on_returncodeextra_ok_returncodes extra_environ unset_environspinnerlog_failed_cmd stdout_only command_descrc  Cs|dkr g}|dkrg}|r*tj} tj} n tj} t} t| k} | oL|dk }| d| tj }|rp| ||D]}| |dqtz0t j t|t jt j| st jnt j||dd}Wn6tk r}z|rtd|| W5d}~XYnXg}| s|jst|jst|j|j}|s.qh|}||d| ||r|s\t|qz |W5|jr|jXd|}nT|\}}|D]}| |q|||D]}| |q|||}|jo|j|k}|r(|s t|r| dn | d |r|d krt!| |j| sJ|ndd }|rtj"d |d didtjdt#t$|ddidtjdt#|pdddid|n8|dkrt%d| |j|n|dkrnt&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 %s errordoner))command_description exit_code output_linesz%srichT)extraz*[bold magenta]full command[/]: [blue]%s[/]markupz[bold magenta]cwd[/]: %sz [inherit]warnz$Command "%s" had error code %s in %signorezInvalid value: on_returncode=)'rinfologgingINFOverbosergetEffectiveLevelosenvironcopyupdatepop subprocessPopenr(PIPESTDOUT Exceptioncriticalr7AssertionErrorr6closereadlinerstriprspinwaitr# communicate splitlines returncodefinishr r=r r%warning ValueError)r*r+r,r-r.r/r0r1r2r3r4log_subprocess used_levelshowing_subprocess use_spinnerr9nameprocexc all_outputlineoutputouterrout_lineerr_lineproc_had_errorr=rrrcall_subprocess8s                              rr).N)messagercs2dttttttttfddfdd }|S)zProvide 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/rc s*t}t||||dW5QRXdS)N)r4r,r/r1)r rr)r*r,r/r1rsrrrunners z+runner_with_spinner_message..runner)NN)rrrrr)rsrurrtrrunner_with_spinner_messages rv) FNr)NNNNTF)"rHrLrrQtypingrrrrrrrr Zpip._vendor.rich.markupr pip._internal.cli.spinnersr r pip._internal.exceptionsr pip._internal.utils.loggingrrpip._internal.utils.miscrr CommandArgsrr%r(boolintrrrvrrrrsL(       )