ó •abc@@s1dZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl 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|ds, (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_optstlentinsertt takes_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(NtmaintCommandst Descriptions s s%s: %s R(thasattrtparsertlstriptrstripR(R)R*(Rt descriptiontlabel((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.(t option_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„Z d„Z d „Z RS( ssCustom option parser which updates its defaults by checking the configuration files and environmental variablescO@stjƒ|_|jdƒ|_|jdtƒ|_|jƒ|_|jrd|jj |jƒn|jsst ‚t j 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(Rt config_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(t check_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|j ƒ}|j ||ƒ||jq>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 (t print_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.pyts      "O