
    Qh#                       d dl mZ d dlZd dlZd dlZd dlZd dlmZmZ d dl	m
Z
mZmZmZ d dlmZ d dlmZmZ d dlmZ d dlmZmZ d d	lmZ eeeef      Zdd
ZddZddZ	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ ddZ!y)    )annotationsN)IterableMapping)AnyCallableLiteralUnion)escape)SpinnerInterfaceopen_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger)
HiddenTextc                 ~    g }| D ]5  }t        |t              r|j                  |       %|j                  |       7 |S )z&
    Create a CommandArgs object.
    )
isinstancelistextendappend)argscommand_argsargs      Z/var/www/teggl/fontify/venv/lib/python3.12/site-packages/pip/_internal/utils/subprocess.pymake_commandr      sJ     !#L % c4 $ $%     c                2    dj                  d | D              S )z/
    Format command arguments for display.
     c              3     K   | ]G  }t        |t              rt        j                  t	        |            nt        j                  |       I y w)N)r   r   shlexquotestr).0r   s     r   	<genexpr>z&format_command_args.<locals>.<genexpr>.   s<       ",C!<CH%++cBRRs   AA)join)r   s    r   format_command_argsr%   %   s"     88   r   c                d    | D cg c]   }t        |t              r|j                  n|" c}S c c}w )z=
    Return the arguments in their raw, unredacted form.
    )r   r   secret)r   r   s     r   reveal_command_argsr(   4   s,     KOO3*S*5CJJ3>OOOs   %-c
          	        |g }|g }|r!t         j                  }t        j                  }nt         j                  }t
        }t        j                         |k  }| xr |du} |d|
       t        j                  j                         }|r|j                  |       |D ]  }|j                  |d        	 t        j                  t        |       t        j                  t        j                  |	st        j                   nt        j                  ||d      }g }|	s|j&                  sJ |j(                  sJ |j(                  j+                          	 |j&                  j-                         }|snC|j/                         }|j1                  |dz           ||       |r|sJ |j3                          `	 |j5                          |j&                  r|j&                  j+                          	 dj7                  |      }nq|j9                         \  }}|j;                         D ]
  } ||        |j1                  |       |j;                         D ]
  } ||        |j1                  |       |}|j<                  xr |j<                  |v}|r)|sJ |r|j?                  d	       n|j?                  d
       |r|dk(  rtA        |
|j<                  |s|nd      }|rmt        jB                  d|ddi       t        j                  dtE        tG        |             ddi       t        j                  dtE        |xs d      ddi       ||dk(  r$t        jH                  d|
|j<                  |       |S |dk(  r	 |S tK        d|      |S # t"        $ r}|rt        j$                  d||
        d}~ww xY w# |j&                  r|j&                  j+                          w w xY w)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backslashreplace)stdinstdoutstderrcwdenv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   r3   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_spinnerr/   nameprocexc
all_outputlineoutputouterrout_lineerr_lineproc_had_errorr3   s                               r   call_subprocessrr   ;   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%   6A!N	 3N4 		N1N,,N14)Oc                (     	 	 d	 	 	 	 	 	 	 d fd}|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.
    c                f    t              5 }t        | |||       d d d        y # 1 sw Y   y xY w)N)rb   r.   r]   r_   )r   rr   )rY   r.   r]   r_   messages       r   runnerz+runner_with_spinner_message.<locals>.runner   s;    
 '" 	g$+	 	 	s   '0)NN)rY   	list[str]r.   
str | Noner]   Mapping[str, Any] | NonereturnNone )ru   rv   s   ` r   runner_with_spinner_messager}      s;     26 0 
	 Mr   )r   zstr | HiddenText | CommandArgsrz   CommandArgs)r   list[str] | CommandArgsrz   r!   )r   r   rz   rw   )	FNr5   NNNNTF)rY   r   rZ   boolr.   rx   r[   z"Literal['raise', 'warn', 'ignore']r\   zIterable[int] | Noner]   ry   r^   zIterable[str] | Noner_   zSpinnerInterface | Noner`   bool | Nonera   r   rb   r!   rz   r!   )ru   r!   rz   zCallable[..., None])"
__future__r   r?   rC   r   rH   collections.abcr   r   typingr   r   r   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(   rr   r}   r|   r   r   <module>r      s    "  	   - 0 0 * E @ B /5j)*"P 8?15.2*.'+"&$e	 ee 
e 6	e
 /e ,e (e %e  e e e 	ePr   