a Ran@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_virtualenvCommandcseZdZUdZeed<dZeed<deeeddfdd Zdd d d Z e dd d dZ e e ee dddZe eee e efdddZe ee dddZe ee dddZZS)rusageFignore_require_venvN)namesummaryisolatedreturnc 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__O/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/base_command.pyr+.s*   zCommand.__init__)r&cCsdSNr4)r1r4r4r5r0LszCommand.add_options)optionsr&cCst|drJdS)zf This is a no-op so that commands by default do not do the pip version check. Zno_indexN)hasattr)r1r7r4r4r5handle_pip_version_checkOsz Command.handle_pip_version_check)r7argsr&cCstdSr6)NotImplementedError)r1r7r:r4r4r5runXsz Command.runr:r&cCs |j|Sr6)r- parse_argsr1r:r4r4r5r>[szCommand.parse_argscCsXzH|$||WdWtS1s40YWtn t0dSr6)Z main_context_mainloggingZshutdownr?r4r4r5main_s  z Command.mainc sB|t|_|t||\}}|j|j|_t|j|j|j d|j rZdt j d<|j rrd|j t j d<|jr|jststdtt|jrt|j|_t|jstd|jd|_d|jvrtd td tftd tfd fd d }z0|js||j}n|j}|||W| |S| |0dS)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_funcr&cs$tttdfdd }|S)Nr=c sz|}t|tsJ|WSty`}z,tt|tjdddtWYd}~Sd}~0tt t t fy}z,tt|tjdddt WYd}~Sd}~0t y}z*td|tjdddt WYd}~Sd}~0ty*tdtjdtjkr"tjtjdt YStyXtdtjdddt YSty|tjdddtYS0dS) 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_wrappersB    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<r9)r1r:r7r]r<r4r\r5r@fsP           1   z Command._main)F)__name__ __module__ __qualname__r!rM__annotations__r"boolr+r0rr9rrJr<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 getLoggerrfrKrr4r4r4r5s.