ó
'šMc           @   sš  d  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	 d d l
 m Z m Z d e j f d „  ƒ  YZ d e j f d	 „  ƒ  YZ y0 e j d
 ƒ Z d e e j e j d  f Z Wn e j k
 rð d Z n Xe d d d e d e d e ƒ  d d ƒ Z e j 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$ ƒe j d% d d& d' d( d) d* d e j ƒe j d+ d, d d- d d d) e d e j ƒe j d. d/ d d0 d d d) e d e j ƒe j d1 d2 d d3 d d4 d) d5 d d6 ƒe j d7 d8 d d9 d d4 d) d5 d d: ƒe j d; d d< d d= d d> ƒe j d? d d@ d d d) e d e j ƒe j dA dB d dC d d= d) e d e j ƒe j dD d dE d d d) e d e j ƒe j dF d dG d' d( d) d* d dH ƒe j dI dJ d dK d dL d' dM d) dN d dO ƒe j dP d dQ d' d( d) d* d e j ƒe j dR d dS d' d( d) d* d e j ƒe j ƒ  d S(T   s   Base option parser setupiÿÿÿÿN(   t	   strtobool(   t   ConfigParsert   string_types(   t   default_config_filet   default_log_filet   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(   t   parsert   Nonet   update_defaultst   defaultst   optparset   IndentedHelpFormattert   expand_default(   t   selft   option(    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyR      s    (   t   __name__t
   __module__t   __doc__R   (    (    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyR      s   t   ConfigOptionParserc           B   sG   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d 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   configt   popR   t   get_config_filest   filest   readt   AssertionErrorR
   t   OptionParsert   __init__(   R   t   argst   kwargs(    (    s2   /usr/lib/python2.7/dist-packages/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(    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyR   #   s    c         C   ss  i  } x3 d |  j  f D]" } | j t |  j | ƒ ƒ ƒ q W| j t |  j ƒ  ƒ ƒ x| j ƒ  D]	\ } } | j d d ƒ } | j d ƒ sœ d | } n  |  j | ƒ } | d k	 rb | sÃ qb n  | j
 d k rá | j ƒ  } n	 d | _ | j
 d k rt | ƒ } n  y | j | | ƒ } Wn: t j k
 rZt j ƒ  d } d | GHt j d ƒ n X| | | j <qb qb 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   globalt   _t   -s   --s   --%st   appendi   t
   store_truet   store_falset   counts)   An error occured during configuration: %si   N(   R+   R,   s   count(   R   t   updatet   dictt   get_config_sectiont   get_environ_varst   itemst   replacet
   startswitht
   get_optionR   t   actiont   splitt   nargsR    t   convert_valueR
   t   OptionValueErrort   syst   exc_infot   exitt   dest(   R   R	   R   t   sectiont   keyt   valR   t   e(    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyR   )   s2     		c         C   s&   |  j  j | ƒ r" |  j  j | ƒ Sg  S(   s    Get a section of a configuration(   R   t   has_sectionR2   (   R   R   (    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyR0   N   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_t    N(   R    R!   R2   R4   R3   t   lower(   R   t   prefixR@   RA   (    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyR1   T   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   ValuesR	   R   t   copyt   _get_all_optionsR"   R>   t
   isinstanceR   t   get_opt_stringt   check_value(   R   R	   R   t   defaultt   opt_str(    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyt   get_default_valuesZ   s    	 (	   R   R   R   R   R   R   R0   R1   RQ   (    (    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyR      s   			%	t   pips   %s from %s (python %s)i   t   usages   %prog COMMAND [OPTIONS]t   versiont   add_help_optiont	   formatterR   R'   s   -hs   --helpR>   t   helpR6   R+   s	   Show helps   -Es   --environmentt   venvt   metavart   DIRsd   virtualenv environment to run pip in (either give the interpreter or the environment base directory)s   -ss   --enable-site-packagest   site_packagessƒ   Include site-packages in virtualenv if one is to be created. Ignored if --environment is not used or the virtualenv already exists.s   --virtualenv-baset	   venv_baset   typet   strRO   RE   s   --require-virtualenvs   --require-venvt   require_venvs   --respect-virtualenvs   --respect-venvt   respect_venvs   -vs	   --verboset   verboseR-   i    s   Give more outputs   -qs   --quiett   quiets   Give less outputs   --logt   logt   FILENAMEsA   Log file where a complete (maximum verbosity) record will be kepts   --log-explicit-levelst   log_explicit_levelss   --local-logs
   --log-filet   log_files
   --no-inputt   no_inputs   --proxyt   proxysð   Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you are behind an authenticated proxy.  If you provide user@proxy.server:port then you will be prompted for a password.s	   --timeouts   --default-timeoutt   SECONDSt   timeoutt   floati   s1   Set the socket timeout (default %default seconds)s   --default-vcst   default_vcss   --skip-requirements-regext   skip_requirements_regex(   R   R;   R
   t   pkg_resourcesR    t   distutils.utilR    t   pip.backwardcompatR   R   t   pip.locationsR   R   R   R   R   R   t   get_distributiont   pip_distt   locationRT   t   DistributionNotFoundR   R#   R   t
   add_optiont   SUPPRESS_HELPt   disable_interspersed_args(    (    (    s2   /usr/lib/python2.7/dist-packages/pip/baseparser.pyt   <module>   sæ   R
					
	
	
		
	

	

