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/e0Z1GdddeZ2dS)z(Base Command class, and related routines)absolute_importprint_functionN) cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERRORSUCCESS UNKNOWN_ERRORVIRTUALENV_NOT_FOUND) BadCommand CommandErrorInstallationErrorPreviousBuildDirErrorUninstallationError) deprecated)BrokenStdoutLoggingError setup_logging)get_prog)MYPY_CHECK_RUNNING)running_under_virtualenv)ListTupleAny)ValuesCommandcsNeZdZdZdZdfdd ZddZddZd d Zd d Z d dZ Z S)rNFcstt||jdt|ftd||j|d}||_||_t f||_ d|j }t |j ||_ttj|j }|j |dS)Nz%s %sF)usageprogZ formatterZadd_help_optionname descriptionisolatedz %s Options)superr__init__rrr__doc__rsummaryrparser capitalizeoptparseZ 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__cCst|drtdS)zf This is a no-op so that commands by default do not do the pip version check. Zno_indexN)hasattrAssertionError)r)optionsr,r,r-handle_pip_version_checkPsz Command.handle_pip_version_checkcCstdSN)NotImplementedError)r)r0argsr,r,r-runZsz Command.runcCs |j|Sr2)r& parse_argsr)r4r,r,r-r6^szCommand.parse_argsc Cs>z.|||W5QRW SQRXW5tXdSr2)loggingZshutdownZ main_context_mainr7r,r,r-maincs $z Command.mainc Cs||\}}|j|j|_t|j|j|jd}tjdddkrhd}t dkrZd|}t |ddd|j rxdt jd <|jrd |jt jd <|jr|jststd ttzz(|||}t|tr|WWSWntk r2}z.tt|tjd ddtWYWRSd}~XYn>t t!t"fk r}z.tt|tjd ddt#WYWSd}~XYnt$k r}z*td|tjd ddt#WYWSd}~XYnt%k rt&dtj'd|t(j)krt*j+tj'dt#YWfSt,k rDtdtjd ddt#YW2St-k rntjdddt.YWSXW5||Xt/S)N) verbosityno_colorZ user_log_file)r=zA 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-supportZCPythonzPython 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_in1Z 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:)0r6verbosequietr;rr<logsys version_infoplatformZpython_implementationrZno_inputosenvironZ exists_actionjoinZ require_venvignore_require_venvrloggerZcriticalexitr r1r5 isinstanceintrstrdebugr rrr rrrprintstderrr8DEBUG traceback print_excKeyboardInterrupt BaseExceptionr r )r)r4r0Z level_numbermessageZstatusexcr,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 r r Zpip._internal.exceptionsr rrrrZpip._internal.utils.deprecationrZpip._internal.utils.loggingrrZpip._internal.utils.miscrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrtypingrrrr__all__Z getLoggerr\rMrr,r,r,r-s0