????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_internal/commands/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_internal/commands/configuration.pyc

�
}�\]c@s�ddlZddlZddlZddlmZddlmZmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZddlmZeje�Zd	efd
��YZdS(i����N(tCommand(tERRORtSUCCESS(t
Configurationtget_configuration_filestkinds(tPipError(t
deprecated(tget_prog(trunning_under_virtualenvtConfigurationCommandcBs�eZdZdZdZdZd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZRS(s9Manage 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

        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.
    tconfigs�
        %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
    s&Manage local and global configuration.c
Ostt|�j||�d|_|jjddddddddd�|jjd	dd
dddtdd�|jjd
dddddtdd�|jjddddddtdd�|jjddddddtdd�|jj	d|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 onlys--venvt	venv_filesY[Deprecated] Use the current environment configuration file in a virtual environment onlyi(
tsuperR
t__init__tNonet
configurationtcmd_optst
add_optiontFalsetparsertinsert_option_group(tselftargstkwargs((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyR/sB						c	Cs<i|jd6|jd6|jd6|jd6|jd6}|sO|d|krxtjdjdjt	|����t
S|d}y|j|d	|d
k�}Wn(tk
r�}tj|j
d�t
SXtd
|jd|�|_|jj�y||||d�Wn(tk
r7}tj|j
d�t
SXtS(NtlisttedittgettsettunsetisNeed an action ({}) to perform.s, t
need_valuetisolatedt	load_onlyi(sgetssetsunsetsedit(tlist_valuestopen_in_editortget_nametset_name_valuet
unset_nametloggerterrortformattjointsortedRt_determine_fileRR!Rt
isolated_modeRtloadR(R toptionsR!thandlersRR*te((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pytrunds4






cCs
|jrM|jrMt�r>t|_tddddd�qMtd��ngtj|jftj	|j
ftj|jffD]\}}|r�|^q�}|s�|s�dSt
d�t�tjD��r�tjStjSnt|�dkr�|d	Std
��dS(Ns&The --venv option has been deprecated.treplacements--sitetgone_ins19.3sHLegacy --venv option requires a virtual environment. Use --site instead.css!|]}tjj|�VqdS(N(tostpathtexists(t.0tsite_config_file((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pys	<genexpr>�siisLNeed exactly one file to operate upon (--user, --site, --global) to perform.(RRR	tTrueRRRtUSERRtGLOBALRtSITERtanyRtlen(R R8R(tkeytvaluetfile_options((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyR5�s4		

cCsS|j|ddd�x6t|jj��D]\}}tjd||�q,WdS(NR#tnis%s=%r(t_get_n_argsR4RtitemsR0tinfo(R R8R!RIRJ((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyR+�s"cCs>|j|ddd�}|jj|�}tjd|�dS(Ns
get [name]RLis%s(RMRt	get_valueR0RO(R R8R!RIRJ((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyR-�scCs?|j|ddd�\}}|jj||�|j�dS(Nsset [name] [value]RLi(RMRt	set_valuet_save_configuration(R R8R!RIRJ((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyR.�scCs6|j|ddd�}|jj|�|j�dS(Nsunset [name]RLi(RMRtunset_valueRR(R R8R!RI((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyR/�scCs�|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_editorRtget_file_to_editRRt
subprocesst
check_calltCalledProcessErrorR2t
returncode(R R8R!R
tfnameR:((sC/tmp/pip-install-ewDPok/pip/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(RHR2RR(R R!texampleRLtmsg((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyRM�scCsHy|jj�Wn0tk
rCtjddd�td��nXdS(Ns:Unable to save configuration. Please report this as a bug.texc_infoisInternal Error.(Rtsavet	ExceptionR0R1R(R ((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyRR�s
cCsZ|jdk	r|jSdtjkr0tjdSdtjkrJtjdStd��dS(NtVISUALtEDITORs"Could not determine editor to use.(R
RR>tenvironR(R R8((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyRT�s(t__name__t
__module__t__doc__tnametusagetsummaryRR;R5R+R-R.R/R,RMRRRT(((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyR
s	5	+	)							(tloggingR>RVtpip._internal.cli.base_commandRtpip._internal.cli.status_codesRRtpip._internal.configurationRRRtpip._internal.exceptionsRtpip._internal.utils.deprecationRtpip._internal.utils.miscRtpip._internal.utils.virtualenvR	t	getLoggerRcR0R
(((sC/tmp/pip-install-ewDPok/pip/pip/_internal/commands/configuration.pyt<module>s