3 ”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$|j|ƒq |j|ƒq W|S)z& Create a CommandArgs object. )Ú isinstanceÚlistÚextendÚappend)ÚargsÚ command_argsÚarg©rú�/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/utils/subprocess.pyÚ make_commands    rcCsdjdd„|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|ƒ}dj|ƒ}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 Csf|dkr g}|dkrg}|r*tj} tj} n tj} tj} tjƒ| k} | oN|dk } |dkr`t|ƒ}| d|ƒtj j ƒ}|r‚|j |ƒx|D]}|j |dƒqˆWyBt jt|ƒt jt jt j||d�}|jsÈt‚|jsÒt‚|jjƒWn:tk �r}z| �rtjd||ƒ‚WYdd}~XnXg}xRt|jjƒƒ}|�s6P|jƒ}|j|dƒ| |ƒ| �r |�sdt‚|jƒ�q Wz |jƒWd|j�r’|jjƒX|j�o¤|j|k}| �rÒ|�s¶t‚|�rÈ|jdƒn |jdƒ|�r\|dk�r$| �r | �r t ||||jd �}tj!|ƒd j"|j|ƒ}t#|ƒ‚n8|d k�rBtj$d ||j|ƒn|d k�rNnt%dj"|ƒƒ‚dj&|ƒ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:     ( ,