ó œ0{Yc@sôdZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z mZddlmZdejfd „ƒYZd efd „ƒYZd ejfd „ƒYZdefd„ƒYZdS(sBase option parser setupiÿÿÿÿN(t strtobool(t ConfigParsert string_types(tdefault_config_file(tget_terminal_sizetget_prog(t pkg_resourcestPrettyHelpFormattercBs\eZdZd„Zd„Zddd„Zd„Zd„Zd„Zd „Z d „Z RS( s4A prettier/less verbose help formatter for optparse.cOsCd|ds, (t_format_option_strings(Rtoption((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pytformat_option_stringsss <%s>s, cCs¶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((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyRs   cCs|dkrdS|dS(NtOptionsRs: ((Rtheading((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pytformat_heading3s cCs#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((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyt format_usage8scCsy|rqt|jdƒr!d}nd}|jdƒ}|jƒ}|jtj|ƒdƒ}d||f}|SdSdS(NtmaintCommandst Descriptions s s%s: %s R(thasattrtparsertlstriptrstripR%R&R'(Rt descriptiontlabel((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pytformat_description@s  cCs|r |SdSdS(NR((Rtepilog((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyt format_epilogRscCs3g|jdƒD]}||^q}dj|ƒS(Ns (tsplitR(Rttexttindenttlinet new_lines((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyR%Ys&( t__name__t __module__t__doc__R RRR$R*R4R6R%(((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyRs      tUpdatingDefaultsHelpFormattercBseZdZd„ZRS(s£Custom help formatter for use in ConfigOptionParser that updates the defaults before expanding them, allowing them to show up correctly in the help listingcCs;|jdk r(|jj|jjƒntjj||ƒS(N(R/tNonetupdate_defaultstdefaultsR R texpand_default(RR((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyRCcs(R<R=R>RC(((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyR?^stCustomOptionParsercBs eZd„Zed„ƒZRS(cOs6|j||Ž}|jjƒ|jj||ƒ|S(s*Insert an OptionGroup at a given position.(tadd_option_groupt option_groupstpopR(RtidxRRtgroup((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pytinsert_option_groupjs cCs2|j}x!|jD]}|j|jƒqW|S(s<Get a list of all options, including those in option groups.(t option_listRFtextend(Rtresti((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pytoption_list_allss (R<R=RJtpropertyRO(((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyRDis tConfigOptionParsercBsbeZdZd„Zd„Zd„Zd„Zd„Zd„Zdd„Z d „Z d „Z RS( ssCustom option parser which updates its defaults by checking the configuration files and environmental variablescOsxtjƒ|_|jdƒ|_|jƒ|_|jrO|jj|jƒn|js^t‚t j j |||ŽdS(Ntname( RtRawConfigParsertconfigRGRRtget_config_filestfilestreadtAssertionErrorR t OptionParserR (RRR((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyR s cCsNtjjdtƒ}|tjkr(gS|rGtjj|ƒrG|gStgS(NtPIP_CONFIG_FILE(tostenvirontgettFalsetdevnulltpathtexistsR(Rt config_file((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyRUŠs cCsUy|j||ƒSWn:tjk rPtjƒd}d|GHtjdƒnXdS(Nis*An error occurred during configuration: %si(t check_valueR tOptionValueErrortsystexc_infotexit(RRtkeytvalte((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyt check_default’s  cCs,i}x6d|jfD]%}|j|j|j|ƒƒƒqW|j|j|jƒƒƒxÊ|jƒD]¼\}}|j|ƒ}|dk rh|s›qhn|jdkr¹t |ƒ}n|jdkrÿ|j ƒ}g|D]}|j |||ƒ^qÛ}n|j |||ƒ}|||j |j ƒ}|j ||ƒ||jq>Wtj|ƒS(s‹Overridding to make updating the defaults after instantiation of the option parser possible, update_defaults() does the dirty work.( tprocess_default_valuesR tValuesRBRAtcopyt_get_all_optionsR]Rt isinstanceRtget_opt_stringRc(RRBRtdefaulttopt_str((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pytget_default_valuesÏs   cCs(|jtjƒ|jdd|ƒdS(Nis%s (t print_usageRetstderrRg(RR)((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyterrorÞs( R<R=R>R RURkRARqRrRsR‰RŒ(((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyRQ}s      (R>ReR R[R&tdistutils.utilRtpip.backwardcompatRRt pip.locationsRtpip.utilRRt pip._vendorRR RR?RYRDRQ(((s?/opt/alt/python34/lib/python3.4/site-packages/pip/baseparser.pyts    O