
    'j)#                       S SK Jr  S SKrS SKrS SKrS SKrS SKJrJrJ	r	  S SK
JrJr  S SKJr  S SKJrJr  S SKJr  S SKJrJr  S S	KJr  \\\-     rSS
 jrSS jrSS jr         S                       SS jjrSS jr g)    )annotationsN)CallableIterableMapping)AnyLiteral)escape)SpinnerInterfaceopen_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger)
HiddenTextc                     / nU  H<  n[        U[        5      (       a  UR                  U5        M+  UR                  U5        M>     U$ )z
Create a CommandArgs object.
)
isinstancelistextendappend)argscommand_argsargs      V/var/www/html/KUNJ/venv/lib/python3.13/site-packages/pip/_internal/utils/subprocess.pymake_commandr      sH     !#L c4  $ $      c                2    SR                  S U  5       5      $ )z'
Format command arguments for display.
 c              3     #    U  HO  n[        U[        5      (       a  [        R                  " [	        U5      5      O[        R                  " U5      v   MQ     g 7f)N)r   r   shlexquotestr).0r   s     r   	<genexpr>&format_command_args.<locals>.<genexpr>.   s>      C ",C!<!<CH%++cBRRs   AA)join)r   s    r   format_command_argsr%   %   s"     88   r   c                t    U  Vs/ s H&  n[        U[        5      (       a  UR                  OUPM(     sn$ s  snf )z5
Return the arguments in their raw, unredacted form.
)r   r   secret)r   r   s     r   reveal_command_argsr(   4   s3     KOO$3*S*55CJJ3>$OOOs   -5c
                  Uc  / nUc  / nU(       a!  [         R                  n[        R                  nO[         R                  n[
        n[         R                  " 5       U:*  nU(       + =(       a    USLnU" SU
5        [        R                  R                  5       nU(       a  UR                  U5        U H  nUR                  US5        M      [        R                  " [        U 5      [        R                  [        R                  U	(       d  [        R                   O[        R                  UUSSS9n/ nU	(       d  UR&                  (       d   eUR(                  (       d   eUR(                  R+                  5          UR&                  R-                  5       nU(       d  ONUR/                  5       nUR1                  US-   5        U" U5        U(       a  U(       d   eUR3                  5         Mp   UR5                  5         UR&                  (       a  UR&                  R+                  5         S	R7                  U5      nOuUR9                  5       u  nnUR;                  5        H  nU" U5        M     UR1                  U5        UR;                  5        H  nU" U5        M     UR1                  U5        UnUR<                  =(       a    UR<                  U;  nU(       a3  U(       d   eU(       a  UR?                  S
5        OUR?                  S5        U(       a  US:X  a  [A        U
UR<                  U(       d  UOSS9nU(       al  [         RB                  " SUSS0S9  [         R                  " S[E        [G        U 5      5      SS0S9  [         R                  " S[E        U=(       d    S5      SS0S9  UeUS:X  a%  [         RH                  " SU
UR<                  U5        U$ US:X  a   U$ [K        SU< 35      eU$ ! ["         a%  nU(       a  [         R$                  " SUU
5        e SnAff = f! UR&                  (       a  UR&                  R+                  5         f f = f)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.
NzRunning command %slocalebackslashreplace)stdinstdoutstderrcwdenvencodingerrorsz#Error %s while executing command %sT
 errordoneraise)command_description	exit_codeoutput_linesz%srich)extraz*[bold magenta]full command[/]: [blue]%s[/]markupz[bold magenta]cwd[/]: %sz	[inherit]warnz$Command "%s" had error code %s in %signorezInvalid value: on_returncode=)&r   infologgingINFOverboser   getEffectiveLevelosenvironcopyupdatepop
subprocessPopenr(   PIPESTDOUT	Exceptioncriticalr-   r,   closereadlinerstripr   spinwaitr$   communicate
splitlines
returncodefinishr   r5   r	   r%   warning
ValueError)cmdshow_stdoutr/   on_returncodeextra_ok_returncodesextra_environunset_environspinnerlog_failed_cmdstdout_onlycommand_desclog_subprocess
used_levelshowing_subprocessuse_spinnerr0   nameprocexc
all_outputlineoutputouterrout_lineerr_lineproc_had_errorr5   s                               r   call_subprocessrt   ;   s   6 #!  .?.D.D\\
 +22
 +<<>*L )(@WD-@K'6
**//
C

=!d $//??,7:$$Z__%

& J{{{zzz

,,.D;;=DdTk* 4 w 	$IIK{{!!#$ ##%S(H8$ )#(H8$ )#__T@T)TNwNN7#NN6"G#/$0///AZtE
 !''eFD>J!))@.s34#T*
 ")).3-+.#T* Kf$%%6	 M	 h& M <]<MNOOMk  &&5
 	< {{!!# s%   A%O1 .P# 1
P ; PP #.Qc                .   ^    S       SU 4S jjjnU$ )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.
c           	     j   > [        T5       n[        U TUUUS9  S S S 5        g ! , (       d  f       g = f)N)rd   r/   r_   ra   )r   rt   )r[   r/   r_   ra   messages       r   runner+runner_with_spinner_message.<locals>.runner   s2    
 '"g$+ #""s   $
2)NN)r[   	list[str]r/   
str | Noner_   Mapping[str, Any] | NonereturnNone )rw   rx   s   ` r   runner_with_spinner_messager      s@     26 0 
	  Mr   )r   zstr | HiddenText | CommandArgsr}   CommandArgs)r   list[str] | CommandArgsr}   r    )r   r   r}   rz   )	FNr7   NNNNTF)r[   r   r\   boolr/   r{   r]   z"Literal['raise', 'warn', 'ignore']r^   zIterable[int] | Noner_   r|   r`   zIterable[str] | Nonera   zSpinnerInterface | Nonerb   bool | Nonerc   r   rd   r    r}   r    )rw   r    r}   zCallable[..., None])!
__future__r   rA   rE   r   rJ   collections.abcr   r   r   typingr   r   pip._vendor.rich.markupr	   pip._internal.cli.spinnersr
   r   pip._internal.exceptionsr   pip._internal.utils.loggingr   r   pip._internal.utils.miscr   r   r    r   r   r%   r(   rt   r   r   r   r   <module>r      s    "  	   7 7  * E @ B /3#$"P 8?15.2*.'+"&$f	 ff 
f 6	f
 /f ,f (f %f  f f f 	fRr   