Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-37.pyc
Назад
B �5�g�# � @ sx d dl Z d dlZd dlZd dlZd dlmZmZmZmZm Z m Z mZmZ d dl mZ d dlmZmZ d dlmZ d dlmZmZ d dlmZ er�d dlmZ e eeef Zeeeef ed �d d�Zee e ef ed �dd �Zee e ef e e d �dd�Zdee e ef eee deee ee eef eee ee ee ee eed�dd�Z!eed d�dd�Z"dS )� N)� TYPE_CHECKING�Any�Callable�Iterable�List�Mapping�Optional�Union)�escape)�SpinnerInterface�open_spinner)�InstallationSubprocessError)�VERBOSE�subprocess_logger)� HiddenText)�Literal)�args�returnc G s6 g }x,| D ]$}t |t�r$|�|� q |�|� q W |S )z& Create a CommandArgs object. )� isinstance�list�extend�append)r Zcommand_args�arg� r �?/tmp/pip-install-251nq386/pip/pip/_internal/utils/subprocess.py�make_command s r c C s d� dd� | D ��S )z/ Format command arguments for display. � c s s0 | ](}t |t�rt�t|��nt�|�V qd S )N)r r �shlex�quote�str)�.0r r r r � <genexpr>; s z&format_command_args.<locals>.<genexpr>)�join)r r r r �format_command_args1 s r# c C s dd� | D �S )z= Return the arguments in their raw, unredacted form. c S s g | ]}t |t�r|jn|�qS r )r r Zsecret)r r r r r � <listcomp>D s z'reveal_command_args.<locals>.<listcomp>r )r r r r �reveal_command_args@ s r% F�raiseTz"Literal["raise", "warn", "ignore"])�cmd�show_stdout�cwd� on_returncode�extra_ok_returncodes� extra_environ� unset_environ�spinner�log_failed_cmd�stdout_only�command_descr c C s� |dkrg }|dkrg }|r*t j}tj}n t j}t}t �� |k} | oL|dk }|d| � tj� � }|rp|� |� x|D ]}|�|d� qvW y0tj t| �tjtj| s�tjntj||dd�}W n6 tk r� } z|r�t �d|| � � W dd}~X Y nX g }| �s�|j�st�|j�st�|j�� xN|j�� }|�s2P |�� }|�|d � ||� |�r |�s`t�|�� �q W z|�� W d|j�r�|j�� X d�|�}n\|�� \}}x|�� D ]}||� �q�W |�|� x|�� D ]}||� �q�W |�|� |}|j�o|j|k}|�r6|�st�|�r,|� d� n |� d � |�r�|d k�r�t!| |j| �sX|ndd�}|�r�t j"d|d did� t jdt#t$| ��ddid� t jdt#|�p�d�ddid� |�n8|dk�r�t �%d| |j|� n|dk�r�nt&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. NzRunning command %s�backslashreplace)�stdin�stdout�stderrr) �env�errorsz#Error %s while executing command %s� � �error�doner&