a Ren@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!prog formatteradd_help_optionr# descriptionr%z Options)super__init__r#r$r r!rr __doc__parserr capitalizeoptparse OptionGroupcmd_optsrmake_option_group general_groupadd_option_group add_options)selfr#r$r% optgroup_namegen_opts __class__/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/base_command.pyr-.s*   zCommand.__init__)r&cCsdSNr=)r8r=r=r>r7LszCommand.add_options)optionsr&cCst|drJdS)zf This is a no-op so that commands by default do not do the pip version check. no_indexN)hasattr)r8r@r=r=r>handle_pip_version_checkOsz Command.handle_pip_version_check)r@argsr&cCstdSr?)NotImplementedError)r8r@rDr=r=r>runXsz Command.runrDr&cCs |j|Sr?)r/ parse_argsr8rDr=r=r>rH[szCommand.parse_argscCsXzH|$||WdWtS1s40YWtn t0dSr?) main_context_mainloggingshutdownrIr=r=r>main_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_color user_log_file1 PIP_NO_INPUTr'PIP_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)NrGc 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 rrprintsysstderrrLDEBUG traceback print_excKeyboardInterrupt BaseExceptionr)rDstatusexc) level_numberrUr=r>exc_logging_wrappersB    zLCommand._main..intercepts_unhandled_exc..exc_logging_wrapper) functoolswrapsrrY)rUrirh)rUr>intercepts_unhandled_excs+z/Command._main..intercepts_unhandled_exc)! enter_contextrrrHverbosequietrOrrPlogno_inputosenviron exists_actionjoin require_venvr"rrZr[r_exitr cache_dirrrwarningfeatures_enabledrrY debug_moderFrC)r8rDr@rmrFr=rlr>rKfsP           1   z Command._main)F)__name__ __module__ __qualname__r!r\__annotations__r"boolr-r7rrCrrYrFrrHrNrK __classcell__r=r=r;r>r*s     )6r.rjrLlogging.configr1rsr_rbrtypingrrrrrZpip._internal.clir!pip._internal.cli.command_contextr pip._internal.cli.parserr r pip._internal.cli.status_codesr r rrpip._internal.exceptionsrrrrrrpip._internal.utils.filesystemrpip._internal.utils.loggingrrpip._internal.utils.miscrrpip._internal.utils.temp_dirrTempDirRegistryrrpip._internal.utils.virtualenvr__all__ getLoggerr}rZrr=r=r=r>s.