ó
€
\c           @   sê  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m	 Z	 m
 Z
 m Z d d l m Z m Z d d l m Z m Z d e j f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d e j f d „  ƒ  YZ d e f d „  ƒ  YZ y0 e j d ƒ Z d e e j e j d  f Z Wn e j k
 rDd Z n Xd „  Z e j d d d d d d d d ƒe j d d d d d d d e  d e j! ƒe j d d d d  d d! d d" d d# ƒe j d$ d% d d& d d d d' ƒe j d( d) d d* d d! d d" d d+ ƒe j d, d d- d. d/ d d0 ƒe j d1 d d2 d d d e  d e j! ƒe j d3 d4 d d5 d. d/ d e d e j! ƒe j d6 d d7 d d d e  d e j! ƒe j d8 d d9 d: d; d d< d d= ƒe j d> d? d. d@ d dA d: dB d dC d dD ƒe j dE d dF d: d; d d< d e j! ƒe j dG d dH d: d; d d< d e j! ƒe j dI d dJ d: dK dL dM dN dO dP g d g  d dQ d. d d dR ƒe j dS d dT d: d; d d< d. dU d dV ƒg Z" e sæe" j# e j dW d dX d d d e  d dY ƒƒ n  d S(Z   s   Base option parser setupiÿÿÿÿN(   t	   strtobool(   t   ConfigParsert   string_typest   ssl(   t   default_config_filet   default_log_file(   t   get_terminal_sizet   get_progt   PrettyHelpFormatterc           B   s\   e  Z d  Z d „  Z d „  Z d d d „ Z d „  Z d „  Z d „  Z d	 „  Z	 d
 „  Z
 RS(   s4   A prettier/less verbose help formatter for optparse.c         O   sC   d | d <d | d <t  ƒ  d d | d <t j j |  | | Ž d  S(   Ni   t   max_help_positioni   t   indent_incrementi    i   t   width(   R   t   optparset   IndentedHelpFormattert   __init__(   t   selft   argst   kwargs(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyR      s    

c         C   s   |  j  | d d ƒ S(   Ns    <%s>s   , (   t   _format_option_strings(   R   t   option(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   format_option_strings   s    s    <%s>s   , c         C   s¶   g  } | j  r& | j | j  d ƒ n  | j rF | j | j d ƒ n  t | ƒ d k rk | j d | ƒ n  | j ƒ  r© | j pŒ | j j ƒ  } | j | | j ƒ  ƒ n  d j	 | ƒ 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
        i    i   t    (
   t   _short_optst   appendt
   _long_optst   lent   insertt   takes_valuet   metavart   destt   lowert   join(   R   R   t   mvarfmtt   optsept   optsR   (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyR      s    		c         C   s   | d k r d S| d S(   Nt   OptionsR   s   :
(    (   R   t   heading(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   format_heading2   s    c         C   s#   d |  j  t j | ƒ 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_linest   textwrapt   dedent(   R   t   usaget   msg(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   format_usage7   s    c         C   sy   | rq t  |  j d ƒ r! d } n d } | j d ƒ } | j ƒ  } |  j t j | ƒ d ƒ } d | | f } | Sd Sd  S(   Nt   maint   Commandst   Descriptions   
s     s   %s:
%s
R   (   t   hasattrt   parsert   lstript   rstripR&   R'   R(   (   R   t   descriptiont   label(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   format_description?   s    	c         C   s   | r
 | Sd Sd  S(   NR   (    (   R   t   epilog(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   format_epilogQ   s    c         C   s3   g  | j  d ƒ D] } | | ^ q } d j | ƒ S(   Ns   
(   t   splitR   (   R   t   textt   indentt   linet	   new_lines(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyR&   X   s    &(   t   __name__t
   __module__t   __doc__R   R   R   R%   R+   R5   R7   R&   (    (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyR      s   						t   UpdatingDefaultsHelpFormatterc           B   s   e  Z d  Z d „  Z RS(   s£   Custom help formatter for use in ConfigOptionParser that updates
    the defaults before expanding them, allowing them to show up correctly
    in the help listingc         C   s;   |  j  d  k	 r( |  j  j |  j  j ƒ n  t j j |  | ƒ S(   N(   R0   t   Nonet   update_defaultst   defaultsR   R   t   expand_default(   R   R   (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRD   b   s    (   R=   R>   R?   RD   (    (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyR@   ]   s   t   CustomOptionParserc           B   s    e  Z d  „  Z e d „  ƒ Z RS(   c         O   s6   |  j  | | Ž  } |  j j ƒ  |  j j | | ƒ | S(   s*   Insert an OptionGroup at a given position.(   t   add_option_groupt   option_groupst   popR   (   R   t   idxR   R   t   group(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   insert_option_groupi   s    c         C   s2   |  j  } x! |  j D] } | j | j  ƒ q W| S(   s<   Get a list of all options, including those in option groups.(   t   option_listRG   t   extend(   R   t   rest   i(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   option_list_allr   s    
(   R=   R>   RK   t   propertyRP   (    (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRE   h   s   		t   ConfigOptionParserc           B   sY   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z	 d	 „  Z
 RS(
   sv   Custom option parser which updates its defaults by by checking the
    configuration files and environmental variablesc         O   sl   t  j ƒ  |  _ | j d ƒ |  _ |  j ƒ  |  _ |  j j |  j ƒ |  j sR t ‚ t	 j
 j |  | | Ž d  S(   Nt   name(   R   t   RawConfigParsert   configRH   RS   t   get_config_filest   filest   readt   AssertionErrorR   t   OptionParserR   (   R   R   R   (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyR   €   s    c         C   s;   t  j j d t ƒ } | r4 t  j j | ƒ r4 | g St g S(   Nt   PIP_CONFIG_FILE(   t   ost   environt   gett   Falset   patht   existsR   (   R   t   config_file(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRV   ˆ   s    c         C   sK  i  } x6 d |  j  f D]% } | j |  j |  j | ƒ ƒ ƒ q W| j |  j |  j ƒ  ƒ ƒ xé | j ƒ  D]Û \ } } |  j | ƒ } | d	 k	 rh | s› qh n  | j d k r¹ | j	 ƒ  } n	 d | _
 | j d
 k rà t | ƒ } n  y | j | | ƒ } Wn: t j k
 r2t j ƒ  d } d | GHt j d ƒ n X| | | j <qh qh W| 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).t   globalR   i   t
   store_truet   store_falset   counts*   An error occurred during configuration: %si   N(   Rd   Re   s   count(   RS   t   updatet   normalize_keyst   get_config_sectiont   get_environ_varst   itemst
   get_optionRA   t   actionR8   t   nargsR    t   convert_valueR   t   OptionValueErrort   syst   exc_infot   exitR   (   R   RC   RU   t   sectiont   keyt   valR   t   e(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRB   Ž   s,    #		c         C   sY   i  } xL | D]D \ } } | j  d d ƒ } | j d ƒ sG d | } 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(   t   replacet
   startswith(   R   Rk   t
   normalizedRu   Rv   (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRh   °   s    c         C   s&   |  j  j | ƒ r" |  j  j | ƒ Sg  S(   s    Get a section of a configuration(   RU   t   has_sectionRk   (   R   RS   (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRi   ¼   s    t   PIP_c         c   sS   xL t  j j ƒ  D]; \ } } | j | ƒ r | j | d ƒ j ƒ  | f Vq q Wd S(   s@   Returns a generator with all environmental vars with prefix PIP_R   N(   R\   R]   Rk   R{   Rz   R   (   R   t   prefixRu   Rv   (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRj   Â   s    c         C   sž   |  j  s t j |  j ƒ S|  j |  j j ƒ  ƒ } x] |  j ƒ  D]O } | j | j ƒ } t	 | t
 ƒ r> | j ƒ  } | j | | ƒ | | j <q> q> Wt j | ƒ S(   s‹   Overridding to make updating the defaults after instantiation of
        the option parser possible, update_defaults() does the dirty work.(   t   process_default_valuesR   t   ValuesRC   RB   t   copyt   _get_all_optionsR^   R   t
   isinstanceR   t   get_opt_stringt   check_value(   R   RC   R   t   defaultt   opt_str(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   get_default_valuesÈ   s    	 c         C   s(   |  j  t j ƒ |  j d d | ƒ d  S(   Ni   s   %s
(   t   print_usageRq   t   stderrRs   (   R   R*   (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   error×   s    (   R=   R>   R?   R   RV   RB   Rh   Ri   Rj   R‰   RŒ   (    (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyRR   |   s   			"			t   pips   %s from %s (python %s)i   c          C   s   i d d 6t  d 6t ƒ  d 6d d 6t ƒ  d 6}  t |    } t j | d ƒ } | j ƒ  t | _ x t D] } | j	 | ƒ qg W| j
 | ƒ | S(	   Ns   
%prog <command> [options]R)   t   add_help_optiont	   formatterRc   RS   t   progs   General Options(   R_   R@   R   RR   R   t   OptionGroupt   disable_interspersed_argst   versiont   standard_optionst
   add_optionRF   (   t	   parser_kwR0   t   genoptt   opt(    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   create_main_parserå   s    

	s   -hs   --helpR   t   helpRm   s
   Show help.s   --require-virtualenvs   --require-venvt   require_venvRd   R‡   s   -vs	   --verboset   verboseRf   i    sD   Give more output. Option is additive, and can be used up to 3 times.s   -Vs	   --versionR“   s   Show version and exit.s   -qs   --quiett   quiets   Give less output.s   --logt   logR   t   filesB   Log file where a complete (maximum verbosity) record will be kept.s   --log-explicit-levelst   log_explicit_levelss   --local-logs
   --log-filet   log_files
   --no-inputt   no_inputs   --proxyt   proxyt   typet   strR   s<   Specify a proxy in the form [user:passwd@]proxy.server:port.s	   --timeouts   --default-timeoutt   sect   timeoutt   floati   s2   Set the socket timeout (default %default seconds).s   --default-vcst   default_vcss   --skip-requirements-regext   skip_requirements_regexs   --exists-actiont   exists_actiont   choicet   choicest   sRO   t   wt   bR   sP   Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.s   --certt   certR`   s   Path to alternate CA bundle.s
   --insecuret   insecures=   Allow lack of certificate checking when ssl is not installed.($   R?   Rq   R   t   pkg_resourcesR\   R'   t   distutils.utilR    t   pip.backwardcompatR   R   R   t   pip.locationsR   R   t   pip.utilR   R   R   R   R@   RZ   RE   RR   t   get_distributiont   pip_distt   locationR“   t   DistributionNotFoundRA   R™   t   make_optionR_   t   SUPPRESS_HELPR”   R   (    (    (    sU   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/baseparser.pyt   <module>   sî   O`
														