U n a& @sddlmZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z mZddlmZddlmZmZdd lmZerdd lmZmZmZmZmZmZmZmZeeeefZ d Z!d d Z"ddZ#ddZ$ddZ%dddZ&ddZ'dS))absolute_importN) shlex_quote)SpinnerInterface open_spinner)InstallationError)console_to_strstr_to_display)subprocess_logger) HiddenTextpath_to_display)MYPY_CHECK_RUNNING)AnyCallableIterableListMappingOptionalTextUnionz(----------------------------------------cGs2g}|D]$}t|tr"||q||q|S)z& Create a CommandArgs object. ) isinstancelistextendappend)args command_argsargr_C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\pip\_internal\utils\subprocess.py make_commands    rcCsddd|DS)z/ Format command arguments for display.  css,|]$}t|trtt|nt|VqdS)N)rr rstr.0rrrr :sz&format_command_args..)joinrrrrformat_command_args0s r&cCsdd|DS)z= Return the arguments in their raw, unredacted form. cSs g|]}t|tr|jn|qSr)rr secretr!rrr Esz'reveal_command_args..rr%rrrreveal_command_args@sr)c CsDt|}t|dd}t|}d|}dj|||t||td}|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. z command bytes)desczCommand errored out with exit status {exit_status}: command: {command_display} cwd: {cwd_display} Complete output ({line_count} lines): {output}{divider}) exit_statuscommand_display cwd_display line_countoutputdivider)r&rr r$formatlen LOG_DIVIDER) cmd_argscwdlinesr,commandr-r.r0msgrrrmake_subprocess_output_errorJs    r:FraiseTc  Cs6|dkr g}|dkrg}|r*tj} tj} n tj} tj} t| k} | oN|dk } |dkr`t|}| d|tj }|r| ||D]}| |dqz.t jt|t jt jt j||d}|jWn6tk r}z| rtd||W5d}~XYnXg}t|j}|sqJ|}||d| || r|qz |W5|jrj|jX|jo||j|k}| r|r|dn |d|r,|dkr| s| rt||||jd }t |d !|j|}t"|n<|d krt#d !||j|n|d krnt$d!|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. NzRunning command %s)stderrstdinstdoutr6envz#Error %s while executing command %s errordoner;)r5r6r7r,zSCommand errored out with exit status {}: {} Check the logs for full command output.warnz$Command "{}" had error code {} in {}ignorez!Invalid value: on_returncode={!r}r+)&r infologgingINFOdebugDEBUGgetEffectiveLevelr&osenvironcopyupdatepop subprocessPopenr)STDOUTPIPEr=close Exceptioncriticalrr>readlinerstriprspinwait returncodefinishr:rAr2rwarning ValueErrorr$)cmd show_stdoutr6 on_returncodeextra_ok_returncodes command_desc extra_environ unset_environspinnerlog_failed_cmdlog_subprocess used_levelshowing_subprocess use_spinnerr?nameprocexc all_outputlineproc_had_errorr9exc_msgrrrcall_subprocessts               rscsdfdd }|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. Nc s(t}t||||dW5QRXdS)N)r6rdrf)rrs)r_r6rdrfmessagerrrunners z+runner_with_spinner_message..runner)NNr)rurvrrtrrunner_with_spinner_messages rw) FNr;NNNNNT)( __future__rrFrKrPpip._vendor.six.movesrpip._internal.cli.spinnersrrpip._internal.exceptionsrpip._internal.utils.compatrrpip._internal.utils.loggingr pip._internal.utils.miscr r pip._internal.utils.typingr typingr rrrrrrrr Z CommandArgsr4rr&r)r:rsrwrrrrs<     ( ,