Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyo

ó
“tÆ_c@sddlZddlZddlZddlmZddlmZmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZmZddlmZerñdd	lmZmZmZdd
lmZddlmZnejeƒZdefd
„ƒYZdS(iÿÿÿÿN(tCommand(tERRORtSUCCESS(t
Configurationtget_configuration_filestkinds(tPipError(t
indent_log(tget_progtwrite_output(tMYPY_CHECK_RUNNING(tListtAnytOptional(tValues(tKindtConfigurationCommandcBs˜eZdZeZdZd„Zd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zd„Zd„Zd
„Zd„Zd„ZRS(sh
    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 name
    - set: Set the name=value
    - unset: Unset the value associated with name
    - debug: List the configuration files and values defined under them

    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 on the to the user file by
    default.
    s
        %prog [<file-option>] list
        %prog [<file-option>] [--editor <editor-path>] edit

        %prog [<file-option>] get name
        %prog [<file-option>] set name value
        %prog [<file-option>] unset name
        %prog [<file-option>] debug
    c
Csº|jjdddddddddƒ|jjd	dd
dddtddƒ|jjd
dddddtddƒ|jjddddddtddƒ|jjd|jƒdS(Ns--editortdestteditortactiontstoretdefaultthelps\Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if not provided.s--globaltglobal_filet
store_trues+Use the system-wide configuration file onlys--usert	user_files$Use the user configuration file onlys--sitet	site_files3Use the current environment configuration file onlyi(tcmd_optst
add_optiontNonetFalsetparsertinsert_option_group(tself((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pytadd_options8s2				c	Cs@i|jd6|jd6|jd6|jd6|jd6|jd6}|sY|d|kr|tjdd	jt	|ƒƒƒt
S|d}y|j|d
|dkƒ}Wn(tk
rÏ}tj|j
dƒt
SXtd|jd|ƒ|_|jjƒy||||d
ƒWn(tk
r;}tj|j
dƒt
SXtS(NtlisttedittgettsettunsettdebugisNeed an action (%s) to perform.s, t
need_valuetisolatedt	load_onlyi(sgetssetR'R$(tlist_valuestopen_in_editortget_nametset_name_valuet
unset_nametlist_config_valuestloggerterrortjointsortedRt_determine_fileRtargsRt
isolated_modet
configurationtloadR(R!toptionsR7thandlersRR+te((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pytrun_s8







cCsœgtj|jftj|jftj|jffD]\}}|r4|^q4}|s“|sbdStd„t	ƒtjDƒƒr‰tjStjSnt
|ƒdkr­|dStdƒ‚dS(Ncss!|]}tjj|ƒVqdS(N(tostpathtexists(t.0tsite_config_file((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pys	<genexpr>šsiisLNeed exactly one file to operate upon (--user, --site, --global) to perform.(RtUSERRtGLOBALRtSITERRtanyRtlenR(R!R;R)tkeytvaluetfile_options((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR6s"
cCsP|j|dddƒx3t|jjƒƒD]\}}td||ƒq,WdS(NR#tnis%s=%r(t_get_n_argsR5R9titemsR	(R!R;R7RIRJ((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR,šs"cCs;|j|dddƒ}|jj|ƒ}td|ƒdS(Ns
get [name]RLis%s(RMR9t	get_valueR	(R!R;R7RIRJ((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR.¯scCs?|j|dddƒ\}}|jj||ƒ|jƒdS(Nsset [name] [value]RLi(RMR9t	set_valuet_save_configuration(R!R;R7RIRJ((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR/¶scCs6|j|dddƒ}|jj|ƒ|jƒdS(Nsunset [name]RLi(RMR9tunset_valueRQ(R!R;R7RI((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR0œsc
Cs°|j|dddƒ|jƒx‰t|jjƒƒD]r\}}td|ƒxV|D]N}tƒ=tjj	|ƒ}td||ƒ|rž|j
|ƒnWdQXqVWq6WdS(s9List config key-value pairs across different config filesR(RLis%s:s%s, exists: %rN(RMtprint_env_var_valuesR5R9titer_config_filesR	RR?R@RAtprint_config_file_values(R!R;R7tvarianttfilestfnametfile_exists((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR1Äs
"



c	CsMxF|jj|ƒjƒD],\}}tƒtd||ƒWdQXqWdS(s.Get key-value pairs from the file of a variants%s: %sN(R9tget_values_in_configRNRR	(R!RVtnameRJ((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyRUÖs
c	CsltddƒtƒPxHt|jjƒƒD]1\}}dj|jƒƒ}td||ƒq-WWdQXdS(s5Get key-values pairs present as environment variabless%s:tenv_varsPIP_{}s%s=%rN(R	RR5R9tget_environ_varstformattupper(R!RIRJR\((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyRSÞs


"cCs…|j|ƒ}|jjƒ}|dkr9tdƒ‚nytj||gƒWn.tjk
r€}tdj|j	ƒƒ‚nXdS(Ns%Could not determine appropriate file.s*Editor Subprocess exited with exit code {}(
t_determine_editorR9tget_file_to_editRRt
subprocesst
check_calltCalledProcessErrorR^t
returncode(R!R;R7RRXR=((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR-çscCsUt|ƒ|kr9dj|tƒ|ƒ}t|ƒ‚n|dkrM|dS|SdS(sJHelper to make sure the command got the right number of arguments
        sJGot unexpected number of arguments, expected {}. (example: "{} config {}")iiN(RHR^RR(R!R7texampleRLtmsg((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyRM÷scCsBy|jjƒWn*tk
r=tjdƒtdƒ‚nXdS(Ns:Unable to save configuration. Please report this as a bug.sInternal Error.(R9tsavet	ExceptionR2t	exceptionR(R!((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyRQs
cCsZ|jdk	r|jSdtjkr0tjdSdtjkrJtjdStdƒ‚dS(NtVISUALtEDITORs"Could not determine editor to use.(RRR?tenvironR(R!R;((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyR`s(t__name__t
__module__t__doc__tTruetignore_require_venvtusageR"R>R6R,R.R/R0R1RURSR-RMRQR`(((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyRs"		'	.												( tloggingR?Rbtpip._internal.cli.base_commandRtpip._internal.cli.status_codesRRtpip._internal.configurationRRRtpip._internal.exceptionsRtpip._internal.utils.loggingRtpip._internal.utils.miscRR	tpip._internal.utils.typingR
ttypingRRR
toptparseRRt	getLoggerRnR2R(((sU/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/commands/configuration.pyt<module>s
Back to Directory File Manager