"JdJ'ddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZmZddlmZerddlmZe e eefZdZd e eeefd efd Zd e e eefd efd Zd e e eefd e efd Zde e eefde ede eded ef dZ d%de e eefde de eddde eede ede e eefde eede ede e d e e d efd!Z!d"ed ed#fd$Z"dS)&N) TYPE_CHECKINGAnyCallableIterableListMappingOptionalUnion)SpinnerInterface open_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger) HiddenText)Literalz(----------------------------------------argsreturncg}|D]B}t|tr||-||C|S)z& Create a CommandArgs object. ) isinstancelistextendappend)r command_argsargs Q/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/subprocess.py make_commandr!sb!#L%% c4  %    $ $ $ $    $ $ $ $ c@dd|DS)z/ Format command arguments for display.  c3K|]N}t|tr!tjt |ntj|VOdS)N)rrshlexquotestr.0rs r z&format_command_args..;sd ",C!z'reveal_command_args..Es- O O O3*S*55 >CJJ3 O O Orr,r(s rreveal_command_argsr/As P O$ O O OOrcmd_argscwdlines exit_statusct|}d|}d|||t||t}|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})r3command_display cwd_display line_countoutputdivider)r)r'formatlen LOG_DIVIDER)r0r1r2r3commandr9msgs rmake_subprocess_output_errorr@Hsb"(++GWWU^^F  C fu::   JrFraiseTcmd show_stdout on_returncodez"Literal["raise", "warn", "ignore"]extra_ok_returncodes command_desc extra_environ unset_environspinnerlog_failed_cmd stdout_onlyc R|g}|g}|rtj} tj} ntj} t } tj| k} | o|du}|t|}| d|tj }|r| ||D]}| |d tjt|tjtj| s tjn tj||d}n+#t$$r}| rtjd||d}~wwxYwg}| s |jsJ|jsJ|j |j}|snR|}||dz| ||r|sJ|n ||jr|jn&#|jr|jwwxYwd|}n|\}}|D] }| ||||D] }| ||||}|jo|j|v}|r1|sJ|r| d n| d |r|d krE| s.| r,tC||||j }tj"|tG|j||d krtj$d||j|n|dkrntKd||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)stdinstdoutstderrr1enverrorsz#Error %s while executing command %sT r5errordonerA)r0r1r2r3warnz$Command "%s" had error code %s in %signorezInvalid value: on_returncode=)&rinfologgingINFOverbosergetEffectiveLevelr)osenvironcopyupdatepop subprocessPopenr/PIPESTDOUT ExceptioncriticalrOrNclosereadlinerstriprspinwaitr' communicate splitlines returncodefinishr@rTr warning ValueError)rBrCr1rDrErFrGrHrIrJrKlog_subprocess used_levelshowing_subprocess use_spinnerrQnameprocexc all_outputliner9outerrout_lineerr_lineproc_had_errorr?s rcall_subprocessrksg4#! */\ +2 +<>>*L)(@WD-@K*3// N'666 *//  C" =!!! d  $ $/?,7L:$$Z_%         &5    J #{z   ,,..D ;;==D   dTk * * * N4     $ IIKKK{ $ !!###{ $ !!#### $$$##%%S(( % %H N8 $ $ $ $#(( % %H N8 $ $ $ $#_T@T)TN#  # NN7 # # # # NN6 " " "P G # #% -. -3 $ $  "',,,-do|LL L f $ $  %6      h & & N]NNOO O Ms%AD E"D;;E#H#H;message).Nc  ddttdttdttttfddffd }|S)zProvide 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. NrBr1rGrc~t5}t||||ddddS#1swxYwYdS)N)r1rGrI)r r)rBr1rGrIrs rrunnerz+runner_with_spinner_message..runners ' " " g +                       s 266)NN)rr#r rr)rrs` rrunner_with_spinner_messager so"59   #Y  c]  S 12         Mr) FNrANNNNNTF)#rYr]r!rbtypingrrrrrrr r pip._internal.cli.spinnersr r pip._internal.exceptionsr pip._internal.utils.loggingrrpip._internal.utils.miscrrr# CommandArgsr=rr)r/intr@boolrrr,rrrsB                     FEEEEEEE@@@@@@BBBBBBBB//////5j)* 9 c:{:; " eDI{$:;     PeDI{$:;PS PPPP DI{*+  #  9       J:A48"&15-1*.%)"'__ tCy+% &__ #_8 _ #8C=1 _ 3- _GCH-._HSM*_& '_TN_$_ ____D)1Dr