usr/lib/python2.7/site-packages/pip/baseparser.pyc000064400000024771147205226750016074 0ustar00 abc@@s1dZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZmZmZmZddlmZmZejd ejZd ejfd YZd efd YZdejfdYZdefdYZdS(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\eZdZdZdZdddZdZdZdZd 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@sg}|jr&|j|jdn|jrF|j|jdnt|dkrk|jd|n|jr|jp|jj}|j||jndj |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|jdr!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|jdD]}||^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@seZdZdZRS(sCustom 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|jjntjj||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 eZdZedZRS(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|jqW|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@seeZdZeZdZdZdZdZdZ dZ dZ dZ d Z RS( ssCustom option parser which updates its defaults by checking the configuration files and environmental variablescO@stj|_|jd|_|jdt|_|j|_|jrd|jj |jn|jsst t j j |||dS(Ntnametisolated(RtRawConfigParsertconfigRJRUtFalseRVtget_config_filestfilestreadtAssertionErrorRt OptionParserR(RRR((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRs cC@stjjdt}|tjkr(gStt}|js|retjj |re|j |q|j t |j tjj t jdtntrtjj tjt}tjj |r|j |qn|S(NtPIP_CONFIG_FILEtpip(tostenvirontgetRYtdevnulltlistRRVtpathtexistsRRR!Rtuser_config_dirRRtsystprefix(Rt config_fileR[tvenv_config_file((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRZs&         cC@sGy|j||SWn,tjk rB}d|GHtjdnXdS(Ns*An error occurred during configuration: %si(t check_valueRtOptionValueErrorRitexit(RRtkeytvaltexc((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyt check_defaults  c C@si}x6d|jfD]%}|j|j|j|qW|jsg|j|j|jntj|j|_ t }xG|j D]9\}}|sqn|j |}|dkrqn|jdkrt|}n|jdkr/|j}g|D]}|j|||^q }n|jdkr|j|j|j} |j| |}|jpxd } |jpi} |j|| ||| | n|j|||}|||j|j }|j ||||jq>Wtj|S(sOverriding 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 isinstanceRRRm(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|RR(((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyRTs (  5   (RAt __future__RRiRRatreR)tdistutils.utilRtpip._vendor.sixRtpip._vendor.six.movesRt pip.locationsRRRRt pip.utilsRR tcompiletIRRR RBR^RGRT(((s2/usr/lib/python2.7/site-packages/pip/baseparser.pyts      "O