
    жvg#                     8   d dl Z d dlZd dlZd dlZd dlmZmZmZmZ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eeeef         d	efd
Zdeee         ef         d	efdZdeee         ef         d	ee         fdZ	 	 	 	 	 	 	 	 	 d deee         ef         dedee         dddeee                  dee
eef                  deee                  dee         dee         dee         ded	efdZ ded	ed         fdZ!dS )!    N)AnyCallableIterableListLiteralMappingOptionalUnion)escape)SpinnerInterfaceopen_spinner)InstallationSubprocessError)VERBOSEsubprocess_logger)
HiddenTextargsreturnc                      g }| D ]B}t          |t                    r|                    |           -|                    |           C|S )z&
    Create a CommandArgs object.
    )
isinstancelistextendappend)r   command_argsargs      [/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/pip/_internal/utils/subprocess.pymake_commandr      sb     !#L % % c4   	%$$$$ $$$$    c                 @    d                     d | D                       S )z/
    Format command arguments for display.
     c              3      K   | ]N}t          |t                    r!t          j        t	          |                    nt          j        |          V  Od S )N)r   r   shlexquotestr.0r   s     r   	<genexpr>z&format_command_args.<locals>.<genexpr>+   sd         ",C!<!<RCHH%+cBRBR     r   )joinr   s    r   format_command_argsr)   "   s6     88       r   c                     d | D             S )z=
    Return the arguments in their raw, unredacted form.
    c                 J    g | ] }t          |t                    r|j        n|!S  )r   r   secretr$   s     r   
<listcomp>z'reveal_command_args.<locals>.<listcomp>5   s-    OOO3*S*55>CJJ3OOOr   r,   r(   s    r   reveal_command_argsr/   1   s     PO$OOOOr   FraiseTcmdshow_stdoutcwdon_returncodez"Literal["raise", "warn", "ignore"]extra_ok_returncodesextra_environunset_environspinnerlog_failed_cmdstdout_onlycommand_descc
          	         |g }|g }|rt           j        }t          j        }nt           j        }t
          }t          j                    |k    }| o|du} |d|
           t          j        	                                }|r|
                    |           |D ]}|                    |d           	 t          j        t          |           t          j        t          j        |	st          j        nt          j        ||d          }n+# t"          $ r}|rt          j        d||
            d}~ww xY wg }|	s|j        sJ |j        sJ |j                                         	 |j                                        }|snR|                                }|                    |dz               ||           |r|sJ |                                 n	 |                                 |j        r|j                                         n&# |j        r|j                                         w w xY wd                    |          }n|                                \  }}|                                D ]} ||           |                    |           |                                D ]} ||           |                    |           |}|j        o|j        |v}|r1|sJ |r|                    d	           n|                    d
           |r|dk    rtA          |
|j        |s|nd          }|rtt          j!        d|ddi           t          j        dtE          tG          |                     ddi           t          j        dtE          |pd          ddi           ||dk    rt          j$        d|
|j        |           n|dk    rntK          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.
    NzRunning command %sbackslashreplace)stdinstdoutstderrr3   enverrorsz#Error %s while executing command %sT
 errordoner0   )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   rE   r   r)   warning
ValueError)r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   log_subprocess
used_levelshowing_subprocessuse_spinnerrA   nameprocexc
all_outputlineoutputouterrout_lineerr_lineproc_had_errorrE   s                               r   call_subprocessry   8   s   6 #!   .?.D\

 +2
 +<>>*L )(@WD-@KN'666
*//

C "

=!!!  d$$/?,7L:$$Z_%	
 	
 	
     	&5  
 	 J #{z
	,,..D ;;==DdTk*** N4    		$IIKKK{ $!!### { $!!####$$$ ##%%S(( 	% 	%HN8$$$$#(( 	% 	%HN8$$$$#_T@T)TN # 	#NN7####NN6""" PG##/$0//AKZZt  E
  !'eFD>JJJJ!)@.s3344#T*   
 ").3-+..#T*    Kf$$%6	    h&&N]NNOOOMs%   2AD 
D/D**D/H #H*message).Nc           
           	 	 ddt           t                   dt          t                   dt          t          t          t          f                  ddf 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.
    Nr1   r3   r6   r   c                     t                    5 }t          | |||           d d d            d S # 1 swxY w Y   d S )N)r;   r3   r6   r8   )r   ry   )r1   r3   r6   r8   rz   s       r   runnerz+runner_with_spinner_message.<locals>.runner   s    
 '"" 	g$+   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   377)NN)r   r#   r	   r   r   )rz   r}   s   ` r   runner_with_spinner_messager~      so     "59 #Yc]  S 12 
	      Mr   )	FNr0   NNNNTF)"rP   rT   r!   rY   typingr   r   r   r   r   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#   CommandArgsr   r)   r/   boolintry   r~   r,   r   r   <module>r      s    				      S S S S S S S S S S S S S S S S S S S S * * * * * * E E E E E E E E @ @ @ @ @ @ B B B B B B B B / / / / / /5j)*c:{:;     "eDI{$:;     PeDI{$:; PS	 P P P P :A4815-1*.%)"'e e	tCy+%	&ee 
#e 8	e
 #8C=1e GCH-.e HSM*e &'e TNe $e e 	e e e eP )1D      r   