o Ecn@s<dZddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z m Z mZddlmZddlmZddlmZmZddlmZmZmZmZdd lmZmZmZmZm Z m!Z!dd l"m#Z#dd l$m%Z%m&Z&dd l'm(Z(m)Z)dd l*m+Z,ddl*m-Z-m.Z.ddl/m0Z0dgZ1e2e3Z4GdddeZ5dS)z(Base Command class, and related routinesN)Values)AnyCallableListOptionalTuple) cmdoptions)CommandContextMixIn)ConfigOptionParserUpdatingDefaultsHelpFormatter)ERRORPREVIOUS_BUILD_DIR_ERROR UNKNOWN_ERRORVIRTUALENV_NOT_FOUND) BadCommand CommandErrorInstallationErrorNetworkConnectionErrorPreviousBuildDirErrorUninstallationError)check_path_owner)BrokenStdoutLoggingError setup_logging)get_prognormalize_path)TempDirectoryTypeRegistry)global_tempdir_managertempdir_registry)running_under_virtualenvCommandc seZdZUdZeed<dZeed<ddedededd ffd d Zdd d Z de dd fddZ de de ede fddZde edee e effddZde ede fddZde ede fddZZS)rusageFignore_require_venvnamesummaryisolatedreturnNc st||_||_t|jtd|td||j|d|_ d|_ |j d}t |j ||_ttj|j }|j ||dS)N F)r!progZ formatterZadd_help_optionr# descriptionr%z Options)super__init__r#r$r r!rr __doc__parserr capitalizeoptparseZ OptionGroupZcmd_optsrZmake_option_groupZ general_groupZadd_option_group add_options)selfr#r$r%Z optgroup_nameZgen_opts __class__Q/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/cli/base_command.pyr+.s*    zCommand.__init__cCsdSNr4)r1r4r4r5r0LzCommand.add_optionsoptionscCst|drJdS)zf This is a no-op so that commands by default do not do the pip version check. Zno_indexN)hasattr)r1r8r4r4r5handle_pip_version_checkOsz Command.handle_pip_version_checkargscCstr6)NotImplementedError)r1r8r;r4r4r5runXr7z Command.runcCs |j|Sr6)r- parse_argsr1r;r4r4r5r>[s zCommand.parse_argscCsVz%|||WdWtS1swYWtdStwr6)Z main_context_mainloggingZshutdownr?r4r4r5main_s  z Command.mainc s>|t|_|t||\}}|j|j|_t|j|j|j d|j r-dt j d<|j r9d|j t j d<|jrL|jsLtsLtdtt|jrdt|j|_t|jsdtd|jd|_d|jvrntd d td tfd td tfffd d }z|js||j}n|j}|||W| |S| |w)N) verbosityno_colorZ user_log_file1Z PIP_NO_INPUTr'ZPIP_EXISTS_ACTIONz2Could not find an activated virtualenv (required).zThe directory '%s' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.z 2020-resolverz--use-feature=2020-resolver no longer has any effect, since it is now the default dependency resolver in pip. This will become an error in pip 21.0.run_func.r&cs&tdtdtffdd }|S)Nr;r&c stz|}t|ts J|WSty0}ztt|tjdddtWYd}~Sd}~wtt t t fyU}ztt|tjdddt WYd}~Sd}~wt yu}ztd|tjdddt WYd}~Sd}~wtytdtjdtjkrtjtjdt YStytdtjdddt YStytjdddtYSw) NzException information:T)exc_infoz%sz ERROR: Pipe to stdout was broken)filezOperation cancelled by userz Exception:) isinstanceintrloggercriticalstrdebugr rrrrr rrprintsysstderrrADEBUG traceback print_excKeyboardInterrupt BaseExceptionr)r;Zstatusexc) level_numberrFr4r5exc_logging_wrappersJ       zLCommand._main..intercepts_unhandled_exc..exc_logging_wrapper) functoolswrapsrrJ)rFrYrX)rFr5intercepts_unhandled_excs+z/Command._main..intercepts_unhandled_exc)! enter_contextrrr>verbosequietrCrrDlogZno_inputosenvironZ exists_actionjoinZ require_venvr"rrKrLrPexitrZ cache_dirrrZwarningZfeatures_enabledrrJZ debug_moder=r:)r1r;r8r]r=r4r\r5r@fsP          1  z Command._main)F)r&N)__name__ __module__ __qualname__r!rM__annotations__r"boolr+r0rr:rrJr=rr>rBr@ __classcell__r4r4r2r5r*s     ")6r,rZrAZlogging.configr/rbrPrSrtypingrrrrrZpip._internal.clirZ!pip._internal.cli.command_contextr Zpip._internal.cli.parserr r Zpip._internal.cli.status_codesr r rrZpip._internal.exceptionsrrrrrrZpip._internal.utils.filesystemrZpip._internal.utils.loggingrrZpip._internal.utils.miscrrZpip._internal.utils.temp_dirrZTempDirRegistryrrZpip._internal.utils.virtualenvr__all__Z getLoggerrfrKrr4r4r4r5s0