B š•ReÄ&ã @súddlmZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z mZddlmZddlmZmZdd lmZerÀdd lmZmZmZmZmZmZmZmZeeeefZ d Z!d d „Z"dd„Z#dd„Z$dd„Z%ddd„Z&dd„Z'dS)é)Úabsolute_importN)Ú shlex_quote)ÚSpinnerInterfaceÚ open_spinner)ÚInstallationError)Úconsole_to_strÚstr_to_display)Úsubprocess_logger)Ú HiddenTextÚpath_to_display)ÚMYPY_CHECK_RUNNING)ÚAnyÚCallableÚIterableÚListÚMappingÚOptionalÚTextÚUnionz(----------------------------------------cGs6g}x,|D]$}t|tƒr$| |¡q | |¡q W|S)z& Create a CommandArgs object. )Ú isinstanceÚlistÚextendÚappend)ÚargsÚ command_argsÚarg©rú�/builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_internal/utils/subprocess.pyÚ make_commands    rcCsd dd„|Dƒ¡S)z/ Format command arguments for display. ú css,|]$}t|tƒrtt|ƒƒnt|ƒVqdS)N)rr rÚstr)Ú.0rrrrú 8sz&format_command_args..)Újoin)rrrrÚformat_command_args-s r$cCsdd„|DƒS)z= Return the arguments in their raw, unredacted form. cSs g|]}t|tƒr|jn|‘qSr)rr Úsecret)r!rrrrú Csz'reveal_command_args..r)rrrrÚreveal_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)ÚdescÚzŸCommand errored out with exit status {exit_status}: command: {command_display} cwd: {cwd_display} Complete output ({line_count} lines): {output}{divider})Ú exit_statusÚcommand_displayÚ cwd_displayÚ line_countÚoutputÚdivider)r$rr r#ÚformatÚlenÚ LOG_DIVIDER) Úcmd_argsÚcwdÚlinesr*Úcommandr+r,r.ÚmsgrrrÚmake_subprocess_output_errorGs   r8FÚraiseTc  Csd|dkr g}|dkrg}|r*tj} tj} n tj} tj} t ¡| k} | oN|dk } |dkr`t|ƒ}| d|ƒtj   ¡}|r‚|  |¡x|D]}|  |d¡qˆWyBt jt|ƒt jt jt j||d�}|jsÈt‚|jsÒt‚|j ¡Wn:tk �r}z| �rt d||¡‚Wdd}~XYnXg}xRt|j ¡ƒ}|�s6P| ¡}| |d¡| |ƒ| �r |�sdt‚| ¡�q Wz | ¡Wd|j�r’|j ¡X|j�o¤|j|k}| �rÒ|�s¶t‚|�rÈ| d¡n | d¡|�rZ|dk�r"| �s | �r t ||||jd �}t !|¡d  "|j|¡}t#|ƒ‚n8|d k�r@t $d ||j|¡n|d k�rLnt%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)ÚstderrÚstdinÚstdoutr4Úenvz#Error %s while executing command %sÚ ÚerrorÚdoner9)r3r4r5r*zSCommand errored out with exit status {}: {} Check the logs for full command output.Úwarnz$Command "%s" had error code %s in %sÚignorez!Invalid value: on_returncode={!r}r))'r ÚinfoÚloggingÚINFOÚdebugÚDEBUGÚgetEffectiveLevelr$ÚosÚenvironÚcopyÚupdateÚpopÚ subprocessÚPopenr'ÚSTDOUTÚPIPEr;ÚAssertionErrorr<ÚcloseÚ ExceptionÚcriticalrÚreadlineÚrstriprÚspinÚwaitÚ returncodeÚfinishr8r?r0rÚwarningÚ ValueErrorr#)ÚcmdÚ show_stdoutr4Ú on_returncodeÚextra_ok_returncodesÚ command_descÚ extra_environÚ unset_environÚspinnerÚlog_failed_cmdÚlog_subprocessÚ used_levelÚshowing_subprocessÚ use_spinnerr=ÚnameÚprocÚexcÚ all_outputÚlineÚproc_had_errorr7Úexc_msgrrrÚcall_subprocessqs˜                      rrcsd‡fdd„ }|S)zÜProvide 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||||d�WdQRXdS)N)r4rcre)rrr)r^r4rcre)ÚmessagerrÚrunner s  z+runner_with_spinner_message..runner)NNr)rsrtr)rsrÚrunner_with_spinner_messages  ru) FNr9NNNNNT)(Ú __future__rrDrIrNÚpip._vendor.six.movesrÚpip._internal.cli.spinnersrrÚpip._internal.exceptionsrÚpip._internal.utils.compatrrÚpip._internal.utils.loggingr Úpip._internal.utils.miscr r Úpip._internal.utils.typingr Útypingr rrrrrrrr Z CommandArgsr2rr$r'r8rrrurrrrÚs:     ( ,