&<_^M ddlmZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z mZddlmZmZmZmZddlmZdd lmZdd lmZmZejeZGd d e ZdS) ) annotationsN)Values)AnyCallable)Command)ERRORSUCCESS) ConfigurationKindget_configuration_fileskinds)PipError) indent_log)get_prog write_outputceZdZdZdZdZd&dZd'dZd(dZd)dZ d*dZ d*dZ d*dZ d*dZ d*dZd+dZd&dZd*dZd,d"Zd&d#Zd-d$Zd%S).ConfigurationCommanda Manage local and global configuration. Subcommands: - list: List the active configuration (or from the file specified) - edit: Edit the configuration file in an editor - get: Get the value associated with command.option - set: Set the command.option=value - unset: Unset the value associated with command.option - debug: List the configuration files and values defined under them Configuration keys should be dot separated command and option name, with the special prefix "global" affecting any command. For example, "pip config set global.index-url https://example.org/" would configure the index url for all commands, but "pip config set download.timeout 10" would configure a 10 second timeout only for "pip download" commands. If none of --user, --global and --site are passed, a virtual environment configuration file is used if one is active and the file exists. Otherwise, all modifications happen to the user file by default. Ta$ %prog [] list %prog [] [--editor ] edit %prog [] get command.option %prog [] set command.option value %prog [] unset command.option %prog [] debug returnNonec>|jddddd|jdddd d |jd d dd d |jdddd d|jd|jdS)Nz--editoreditorstorez\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.)destactiondefaulthelpz--global global_file store_trueFz+Use the system-wide configuration file onlyz--user user_filez$Use the user configuration file onlyz--site site_filez3Use the current environment configuration file onlyr)cmd_opts add_optionparserinsert_option_groupselfs v/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pip/_internal/commands/configuration.py add_optionsz ConfigurationCommand.add_options<s   9 !    > !      7 !      F !    ''4=99999.dict[str, Callable[[Values, list[str]], None]]cP|j|j|j|j|j|jdS)N)listeditgetsetunsetdebug) list_valuesopen_in_editorget_nameset_name_value unset_namelist_config_valuesr%s r' handler_mapz ConfigurationCommand.handler_mapbs3$'=&_,    r)optionsrargs list[str]intc|}|r |d|vrBtddt |t S|d} |||dv}nC#t$r6}t|jdt cYd}~Sd}~wwxYwt|j ||_ |j  ||||ddnC#t$r6}t|jdt cYd}~Sd}~wwxYwtS)NrzNeed an action (%s) to perform.z, )r.r/r0r-) need_value)isolated load_only)r8loggererrorjoinsortedr_determine_filerr:r isolated_mode configurationloadr )r&r9r:r8rr@es r'runzConfigurationCommand.runls&&((  tAwk11 LL1 &--..   La ,,V/N%N-II    LL # # #LLLLLL  +*i    !!!  K abb 2 2 2 2    LL # # #LLLLLL s<,B C+C;CC>D E#+EEEr>bool Kind | Nonecdtj|jftj|jftj|jffD}|sQ|sdStdttjDr tjStjSt|dkr|dStd)Ncg|] \}}|| SrP).0keyvalues r' z8ConfigurationCommand._determine_file..s4   U     r)c3TK|]#}tj|V$dS)N)ospathexists)rQsite_config_files r' z7ConfigurationCommand._determine_file..sE$/00r)rArzLNeed exactly one file to operate upon (--user, --site, --global) to perform.) r USERrGLOBALrSITEr anyr lenr)r&r9r> file_optionss r'rFz$ConfigurationCommand._determine_files  W./w23W./    # "t(?(A(A%*(M "z!z!   ! # #? " 5   r)c||ddt|jD]=\}}t|D]\}}t d||>dS)Nr,rn%s=%r) _get_n_argsrErHitemsrr&r9r:rRrSs r'r2z ConfigurationCommand.list_valuess v+++ !3!9!9!;!;<< 2 2JC$U[[]]33 2 2 UWc51111 2 2 2r)c||dd}|j|}td|dS)Nz get [name]rArbz%s)rerH get_valuerrgs r'r4zConfigurationCommand.get_namesHt\Q77",,S11T5!!!!!r)c||dd\}}|j|||dS)Nzset [name] [value]rb)rerH set_value_save_configurationrgs r'r5z#ConfigurationCommand.set_name_valuesR%%d,@A%FF U $$S%000   """""r)c||dd}|j||dS)Nz unset [name]rArb)rerH unset_valuerm)r&r9r:rRs r'r6zConfigurationCommand.unset_namesKt^q99 &&s+++   """""r)c||dd|t|jD]\}}t d||D]p}t 5tj |}t d|||r| ||dddn #1swxYwYqdS)z9List config key-value pairs across different config filesr1rrb%s:z%s, exists: %rN) reprint_env_var_valuesrErHiter_config_filesrrrVrWrXprint_config_file_values)r&r9r:variantfilesfname file_existss r'r7z'ConfigurationCommand.list_config_valuessF w!,,, !!###%T%7%I%I%K%KLL F FNGU  ( ( ( F F\\FF"$'.."7"7K !15+FFF"F55guEEE FFFFFFFFFFFFFFF F F Fs:A CC C rur rwstrc|j|D]\\}}t5||kr+|D]\}}t d||dddn #1swxYwY]dS)z.Get key-value pairs from the file of a variantz%s: %sN)rHget_values_in_configrfrr)r&rurwnamerSconfname confvalues r'rtz-ConfigurationCommand.print_config_file_valuess-BB7KKQQSS D DKD% D D5==/4{{}}DD+)$XxCCCC D D D D D D D D D D D D D D D D Ds2A>>B B ctddt5t|jD]-\}}d|}td||. ddddS#1swxYwYdS)z5Get key-values pairs present as environment variablesrqenv_varPIP_rdN)rrrErHget_environ_varsupper)r&rRrSrs r'rrz)ConfigurationCommand.print_env_var_valuessUI&&& \\ 6 6$T%7%H%H%J%JKK 6 6 U...Wgu5555 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6sABB Bc~||}|j}|tdd|vrtd| t j|d|dddS#t $r}|js||_d}~wtj$r}td|j d}~wwxYw)Nz%Could not determine appropriate file."z4Can not open an editor for a file name containing " z "T)shellz(Editor Subprocess exited with exit code ) _determine_editorrHget_file_to_editr subprocess check_callFileNotFoundErrorfilenameCalledProcessError returncode)r&r9r:rrwrJs r'r3z#ConfigurationCommand.open_in_editors''00"3355 =BCC C E\\OOO  V  !V"7"7u"7"7"7t D D D D D D    : $# , V V VTalTTUU U Vs$A55 B<?BB< B77B<examplercrct||kr'd|dtd|d}t||dkr|dS|S)zAHelper to make sure the command got the right number of argumentsz-Got unexpected number of arguments, expected z . (example: "z config z")rAr)r_rr)r&r:rrcmsgs r'rez ConfigurationCommand._get_n_argsso t99>>>>>&jj>>29>>> 3--  667NKr)c |jdS#t$r*tdt dwxYw)Nz:Unable to save configuration. Please report this as a bug.zInternal Error.)rHsave ExceptionrB exceptionrr%s r'rmz(ConfigurationCommand._save_configuration si .   # # % % % % % . . .   L   ,-- -  .s 4Ac|j|jSdtjvrtjdSdtjvrtjdStd)NVISUALEDITORz"Could not determine editor to use.)rrVenvironr)r&r9s r'rz&ConfigurationCommand._determine_editorsU > %> !  # #:h' '  # #:h' '?@@ @r)N)rr)rr*)r9rr:r;rr<)r9rr>rLrrM)r9rr:r;rr)rur rwryrr)r:r;rryrcr<rr)r9rrry)__name__ __module__ __qualname____doc__ignore_require_venvusager(r8rKrFr2r4r5r6r7rtrrr3rermrrPr)r'rrsm0 E$:$:$:$:L    $$$$L    <2222"""" #### #### FFFF DDDD6666VVVV,     . . . .AAAAAAr)r) __future__rloggingrVroptparsertypingrrpip._internal.cli.base_commandrpip._internal.cli.status_codesrr pip._internal.configurationr r r r pip._internal.exceptionsrpip._internal.utils.loggingrpip._internal.utils.miscrr getLoggerrrBrrPr)r'rs]""""""  22222299999999 .-----222222;;;;;;;;  8 $ $HAHAHAHAHA7HAHAHAHAHAr)