Your IP : 18.117.156.84


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

�
��abc@@s1dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZmZddlmZmZejd	ej�Zd
ejfd��YZdefd
��YZdejfd��YZdefd��YZdS(sBase option parser setupi(tabsolute_importN(t	strtobool(tstring_types(tconfigparser(tlegacy_config_filetconfig_basenametrunning_under_virtualenvtsite_config_files(tappdirstget_terminal_sizes^PIP_tPrettyHelpFormattercB@s\eZdZd�Zd�Zddd�Zd�Zd�Zd�Zd	�Z	d
�Z
RS(s4A prettier/less verbose help formatter for optparse.cO@sCd|d<d|d<t�dd|d<tjj|||�dS(Nitmax_help_positionitindent_incrementiitwidth(R	toptparsetIndentedHelpFormattert__init__(tselftargstkwargs((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRs

cC@s|j|dd�S(Ns <%s>s, (t_format_option_strings(Rtoption((s2/usr/lib/python2.7/site-packages/pip/baseparser.pytformat_option_strings!ss <%s>s, cC@s�g}|jr&|j|jd�n|jrF|j|jd�nt|�dkrk|jd|�n|j�r�|jp�|jj�}|j||j��ndj	|�S(s
        Return a comma-separated list of option strings and metavars.

        :param option:  tuple of (short opt, long opt), e.g: ('-f', '--format')
        :param mvarfmt: metavar format string - evaluated as mvarfmt % metavar
        :param optsep:  separator
        iit(
t_short_optstappendt
_long_optstlentinsertttakes_valuetmetavartdesttlowertjoin(RRtmvarfmttoptseptoptsR((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyR$s		cC@s|dkrdS|dS(NtOptionsRs:
((Rtheading((s2/usr/lib/python2.7/site-packages/pip/baseparser.pytformat_heading;scC@s#d|jtj|�d�}|S(sz
        Ensure there is only one newline between usage and the first heading
        if there is no description.
        s
Usage: %s
s  (tindent_linesttextwraptdedent(Rtusagetmsg((s2/usr/lib/python2.7/site-packages/pip/baseparser.pytformat_usage@scC@sy|rqt|jd�r!d}nd}|jd�}|j�}|jtj|�d�}d||f}|SdSdS(NtmaintCommandstDescriptions
s  s%s:
%s
R(thasattrtparsertlstriptrstripR(R)R*(Rtdescriptiontlabel((s2/usr/lib/python2.7/site-packages/pip/baseparser.pytformat_descriptionHs	cC@s|r
|SdSdS(NR((Rtepilog((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyt
format_epilogZscC@s3g|jd�D]}||^q}dj|�S(Ns
(tsplitR!(Rttexttindenttlinet	new_lines((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyR(as&(t__name__t
__module__t__doc__RRRR'R-R7R9R((((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyR
s						tUpdatingDefaultsHelpFormattercB@seZdZd�ZRS(s�Custom help formatter for use in ConfigOptionParser.

    This is updates the defaults before expanding them, allowing
    them to show up correctly in the help listing.
    cC@s;|jdk	r(|jj|jj�ntjj||�S(N(R2tNonet_update_defaultstdefaultsRRtexpand_default(RR((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRFms(R?R@RARF(((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRBfstCustomOptionParsercB@s eZd�Zed��ZRS(cO@s6|j||�}|jj�|jj||�|S(s*Insert an OptionGroup at a given position.(tadd_option_groupt
option_groupstpopR(RtidxRRtgroup((s2/usr/lib/python2.7/site-packages/pip/baseparser.pytinsert_option_groupus
cC@s2|j}x!|jD]}|j|j�qW|S(s<Get a list of all options, including those in option groups.(toption_listRItextend(Rtresti((s2/usr/lib/python2.7/site-packages/pip/baseparser.pytoption_list_all~s
(R?R@RMtpropertyRR(((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRGss		tConfigOptionParsercB@seeZdZeZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
RS(
ssCustom option parser which updates its defaults by checking the
    configuration files and environmental variablescO@s�tj�|_|jd�|_|jdt�|_|j�|_|jrd|jj	|j�n|jsst
�tjj
|||�dS(Ntnametisolated(RtRawConfigParsertconfigRJRUtFalseRVtget_config_filestfilestreadtAssertionErrorRtOptionParserR(RRR((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyR�s	cC@s�tjjdt�}|tjkr(gStt�}|js�|retjj	|�re|j
|�q�|j
t�|j
tjjt
jd�t��nt�r�tjjtjt�}tjj	|�r�|j
|�q�n|S(NtPIP_CONFIG_FILEtpip(tostenvirontgetRYtdevnulltlistRRVtpathtexistsRRR!Rtuser_config_dirRRtsystprefix(Rtconfig_fileR[tvenv_config_file((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRZ�s&	
	
			cC@sGy|j||�SWn,tjk
rB}d|GHtjd�nXdS(Ns*An error occurred during configuration: %si(tcheck_valueRtOptionValueErrorRitexit(RRtkeytvaltexc((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyt
check_default�s
	cC@si}x6d|jfD]%}|j|j|j|���qW|jsg|j|j|j���ntj|j�|_	t
�}xG|j�D]9\}}|s�q�n|j|�}|dkr�q�n|jdkr�t|�}n�|jdkr/|j�}g|D]}|j|||�^q}n�|jdkr�|j|j�|j�}	|j|	|�}|jpxd	}
|jp�i}|j||	|||
|�n|j|||�}|||j<q�Wx$|D]}t|j	|�||<q�Wd|_	|S(
s�Updates the given defaults with values from the config files and
        the environ. Does a little special handling for certain types of
        options (lists).tglobalt
store_truetstore_falsetcountRtcallbackN(RuRvRw((RUtupdatetnormalize_keystget_config_sectionRVtget_environ_varsRtValuesREtvaluestsettitemst
get_optionRCtactionRR:RstaddRtget_opt_stringt
convert_valuet
callback_argstcallback_kwargsRxtgetattr(RRERXtsectiont	late_evalRpRqRtvtopt_strRR((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRD�s@		+
	cC@sYi}xL|D]D\}}|jdd�}|jd�sGd|}n|||<q
W|S(s�Return a config dictionary with normalized keys regardless of
        whether the keys were specified in environment variables or in config
        filest_t-s--s--%s(treplacet
startswith(RR�t
normalizedRpRq((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRz�s
cC@s&|jj|�r"|jj|�SgS(s Get a section of a configuration(RXthas_sectionR�(RRU((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyR{scc@sSxLtjj�D];\}}tj|�rtjd|�j�|fVqqWdS(s@Returns a generator with all environmental vars with prefix PIP_RN(RaRbR�t_environ_prefix_retsearchtsubR (RRpRq((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyR|scC@s�|jstj|j�S|j|jj��}x]|j�D]O}|j|j�}t	|t
�r>|j�}|j||�||j<q>q>Wtj|�S(s�Overriding to make updating the defaults after instantiation of
        the option parser possible, _update_defaults() does the dirty work.(
tprocess_default_valuesRR}RERDtcopyt_get_all_optionsRcRt
isinstanceRR�Rm(RRERtdefaultR�((s2/usr/lib/python2.7/site-packages/pip/baseparser.pytget_default_valuess	 cC@s(|jtj�|jdd|�dS(Nis%s
(tprint_usageRitstderrRo(RR,((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyterror#s(R?R@RARYRVRRZRsRDRzR{R|R�R�(((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRT�s	
	(		5				(RAt
__future__RRiRRatreR)tdistutils.utilRtpip._vendor.sixRtpip._vendor.six.movesRt
pip.locationsRRRRt	pip.utilsRR	tcompiletIR�RR
RBR^RGRT(((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyt<module>s "O


?>