U ��.eh�@s6dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZddlmZmZddlmZmZmZmZmZddlmZmZmZmZmZdd lmZdd l m!Z!m"Z"dd l#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 �Zd d �Z d d�Z �Z S)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�optparseZ OptionGroupZcmd_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__cCsdS)zf This is a no-op so that commands by default do not do the pip version check. Nr,)r)�optionsr,r,r-�handle_pip_version_checkPsz Command.handle_pip_version_checkcCst�dS�N)�NotImplementedError)r)r.�argsr,r,r-�runZsz Command.runcCs |j�|�Sr0)r&� parse_args�r)r2r,r,r-r4^szCommand.parse_argsc Cs>z.|���|�|�W5QR�W� SQRXW5t��XdSr0)�loggingZshutdownZ main_context�_mainr5r,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. )Z replacementZgone_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:)0r4�verbose�quietr9rr:�log�sys� version_info�platformZpython_implementationrZno_input�os�environZ exists_action�joinZ require_venv�ignore_require_venvr�loggerZcritical�exitr r/r3� isinstance�intr�str�debugr rrr rrr�print�stderrr6�DEBUG� traceback� print_exc�KeyboardInterrupt� BaseExceptionr r )r)r2r.Z level_number�messageZstatus�excr,r,r-r7ksn�� �  �          z Command._main)F) �__name__� __module__� __qualname__rrJr#r/r3r4r8r7� __classcell__r,r,r*r-r0s )3r$Z __future__rrr6Zlogging.configr(rGrFrDrTZpip._internal.clirZ!pip._internal.cli.command_contextrZpip._internal.cli.parserrrZpip._internal.cli.status_codesrr r r r Zpip._internal.exceptionsr rrrrZpip._internal.utils.deprecationrZpip._internal.utils.loggingrrZpip._internal.utils.miscrZpip._internal.utils.typingrZpip._internal.utils.virtualenvr�typingrrrr�__all__Z getLoggerrZrKrr,r,r,r-�s0