Viewing File: /lib/python3.8/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-38.pyc

U

��.eh�@s6dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZmZddlmZmZmZmZmZddlmZmZmZmZmZdd	lmZdd
l m!Z!m"Z"ddl#m$Z$ddl%m&Z&dd
l'm(Z(e&�rddl)m*Z*m+Z+m,Z,ddlm-Z-dgZ.e�/e0�Z1Gdd�de�Z2dS)z(Base Command class, and related routines�)�absolute_import�print_functionN)�
cmdoptions)�CommandContextMixIn)�ConfigOptionParser�UpdatingDefaultsHelpFormatter)�ERROR�PREVIOUS_BUILD_DIR_ERROR�SUCCESS�
UNKNOWN_ERROR�VIRTUALENV_NOT_FOUND)�
BadCommand�CommandError�InstallationError�PreviousBuildDirError�UninstallationError)�
deprecated)�BrokenStdoutLoggingError�
setup_logging)�get_prog)�MYPY_CHECK_RUNNING)�running_under_virtualenv)�List�Tuple�Any)�Values�CommandcsNeZdZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
�ZS)rNFcs�tt|���|jdt�|ft�d||j|d�}||_||_t	f|�|_
d|j��}t�
|j
|�|_t�tj|j
�}|j
�|�dS)Nz%s %sF)�usage�progZ	formatterZadd_help_option�name�description�isolatedz
%s Options)�superr�__init__rrr�__doc__r�summaryr�parser�
capitalize�optparseZOptionGroupZcmd_optsrZmake_option_groupZ
general_groupZadd_option_group)�selfrr%r!Z	parser_kwZ
optgroup_nameZgen_opts��	__class__��B/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.pyr#4s&�
�zCommand.__init__cCst|d�rt�dS)zf
        This is a no-op so that commands by default do not do the pip version
        check.
        Zno_indexN)�hasattr�AssertionError)r)�optionsr,r,r-�handle_pip_version_checkPsz Command.handle_pip_version_checkcCst�dS�N)�NotImplementedError)r)r0�argsr,r,r-�runZszCommand.runcCs|j�|�Sr2)r&�
parse_args�r)r4r,r,r-r6^szCommand.parse_argsc
Cs>z.|���|�|�W5QR�W�SQRXW5t��XdSr2)�loggingZshutdownZmain_context�_mainr7r,r,r-�maincs
$zCommand.mainc
Cs�|�|�\}}|j|j|_t|j|j|jd�}tjdd�dkrhd}t	�
�dkrZd|}t|ddd�|jrxdt
jd	<|jr�d
�|j�t
jd<|jr�|js�t�s�t�d�t�t��z�z(|�||�}t|t�r�|WW���SW�n�tk
�r2}z.t�t|��tjd
dd�tWY�W��RSd}~XY�n>t t!t"fk
�r�}z.t�t|��tjd
dd�t#WY�W���Sd}~XYn�t$k
�r�}z*t�d|�tjd
dd�t#WY�W��Sd}~XYn�t%k
�rt&dtj'd�|t(j)k�rt*j+tj'd�t#YW�fSt,k
�rDt�d�tjd
dd�t#YW�2St-k
�rntjddd�t.YW�SXW5|�|�Xt/S)N)�	verbosity�no_colorZ
user_log_file�)r=�z�A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-supportZCPythonz�Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. )ZreplacementZgone_in�1ZPIP_NO_INPUT� ZPIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zException information:T)�exc_infoz%sz ERROR: Pipe to stdout was broken)�filezOperation cancelled by userz
Exception:)0r6�verbose�quietr;rr<�log�sys�version_info�platformZpython_implementationrZno_input�os�environZ
exists_action�joinZrequire_venv�ignore_require_venvr�loggerZcritical�exitrr1r5�
isinstance�intr�str�debugr	rrr
rrr�print�stderrr8�DEBUG�	traceback�	print_exc�KeyboardInterrupt�
BaseExceptionrr
)r)r4r0Zlevel_number�messageZstatus�excr,r,r-r9ksn���
�

 
z
Command._main)F)�__name__�
__module__�__qualname__rrLr#r1r5r6r:r9�
__classcell__r,r,r*r-r0s
)3r$Z
__future__rrr8Zlogging.configr(rIrHrFrVZpip._internal.clirZ!pip._internal.cli.command_contextrZpip._internal.cli.parserrrZpip._internal.cli.status_codesrr	r
rrZpip._internal.exceptionsr
rrrrZpip._internal.utils.deprecationrZpip._internal.utils.loggingrrZpip._internal.utils.miscrZpip._internal.utils.typingrZpip._internal.utils.virtualenvr�typingrrrr�__all__Z	getLoggerr\rMrr,r,r,r-�<module>s0

Back to Directory File Manager