
N_c           @   s  d  Z  e Z d d l Z d d l 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 m Z y@ d d l m Z d d l m Z m Z m Z d d l m Z Wn e k
 r e Z n Xe sd d l m Z m Z m Z d d l m Z n  d d l Z d d l Z d d l Z d d l Z d d l m Z m Z d d l Z e Z  e Z! e Z" d	 Z# d
 Z$ d Z% d Z& g  Z' d e( f d     YZ) d   Z* d e) f d     YZ+ d e) f d     YZ, d e, f d     YZ- d e+ f d     YZ. d e+ f d     YZ/ d e) f d     YZ0 d e0 f d     YZ1 d e) f d     YZ2 d  e) f d!     YZ3 d" e) f d#     YZ4 d$ e) f d%     YZ5 d& e5 f d'     YZ6 d( e) f d)     YZ7 d* e7 f d+     YZ8 d, e( f d-     YZ9 d. e9 f d/     YZ: d0 e: f d1     YZ; d2 e9 f d3     YZ< d4 e9 f d5     YZ= d6   Z> d d7  Z@ d8   ZA d9 d:  ZB d;   ZC d<   ZD d=   ZE d>   ZF d d?  ZG d d@  ZH d S(A   s2   
Configuration parser and default values for yum.
iN(   t   ConfigPreProcessort
   varReplace(   t	   INIConfig(   t   NoSectionErrort   NoOptionErrort   ParsingError(   t   RawConfigParser(   t   ConfigParser(   t   get_uuidt   read_in_items_from_dot_dirt   bestt   priorityi   t   objectst   Optionc           B   s\   e  Z d  Z d	 e d  Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z RS(
   s   
    This class handles a single Yum configuration file option. Create
    subclasses for each type of supported configuration option.
    Python descriptor foo (__get__ and __set__) is used to make option
    definition easy and concise.
    c         C   s8   |  j    t |  _ | r+ |  j |  } n  | |  _ d  S(   N(   t   _setattrnamet   Falset   inheritt   parset   default(   t   selfR   t   parse_default(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   __init__A   s
    
	c         C   s   d t  |   |  _ d S(   sm   Calculate the internal attribute name used to store option state in
        configuration instances.
        s   __opt%dN(   t   idt	   _attrname(   R   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   H   s    c         C   s#   | d k r |  St | |  j d  S(   sB  Called when the option is read (via the descriptor protocol). 

        :param obj: The configuration instance to modify.
        :param objtype: The type of the config instance (not used).
        :return: The parsed option value or the default value if the value
           wasn't set in the configuration file.
        N(   t   Nonet   getattrR   (   R   t   objt   objtype(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   __get__N   s    	c         C   st   t  | t  r] y |  j |  } Wq] t k
 rY } t d |  j | t |  f   q] Xn  t | |  j |  d S(   s   Called when the option is set (via the descriptor protocol). 

        :param obj: The configuration instance to modify.
        :param value: The value to set the option to.
        s   Error parsing "%s = %r": %sN(   t
   isinstancet
   basestringR   t
   ValueErrort   _optnamet   strt   setattrR   (   R   R   t   valuet   e(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   __set__\   s    c         C   s,   | |  _  t | |  j t j |  j   d S(   s   Initialise the option for a config instance. 
        This must be called before the option can be set or retrieved. 

        :param obj: :class:`BaseConfig` (or subclass) instance.
        :param name: Name of the option.
        N(   R    R"   R   t   copyR   (   R   R   t   name(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   setupl   s    	c         C   s   t  j  |   } | j   | S(   s|   Return a safe copy of this :class:`Option` instance.

        :return: a safe copy of this :class:`Option` instance
        (   R&   R   (   R   t   new(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   clonev   s    
c         C   s   | S(   s  Parse the string value to the :class:`Option`'s native value.

        :param s: raw string value to parse
        :return: validated native value
        :raise: ValueError if there was a problem parsing the string.
           Subclasses should override this
        (    (   R   t   s(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR      s    c         C   s
   t  |  S(   s  Convert the :class:`Option`'s native value to a string value.  This
        does the opposite of the :func:`parse` method above.
        Subclasses should override this.

        :param value: native option value
        :return: string representation of input
        (   R!   (   R   R#   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   tostring   s    N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R%   R(   R*   R   R,   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   9   s   				
			
c         C   s   |  j    } t | _ | S(   s  Clone an :class:`Option` instance for the purposes of inheritance. The returned
    instance has all the same properties as the input :class:`Option` and shares items
    such as the default value. Use this to avoid redefinition of reused
    options.

    :param option_obj: :class:`Option` instance to inherit
    :return: New :class:`Option` instance inherited from the input
    (   R*   t   TrueR   (   t
   option_objt
   new_option(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   Inherit   s    		t
   ListOptionc           B   s/   e  Z d  Z d e d  Z d   Z d   Z RS(   s'   An option containing a list of strings.c         C   s2   | d  k r g  } n  t t |   j | |  d  S(   N(   R   t   superR4   R   (   R   R   R   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR      s    	c         C   s   | j  d d  } | j  d d  } g  } x[ | j   D]M } | j d  rw | j  d d  } | j t |   q7 n  | j |  q7 W| S(   s  Convert a string from the config file to a workable list, parses
        globdir: paths as foo.d-style dirs.

        :param s: The string to be converted to a list. Commas and
           whitespace are used as separators for the list
        :return: *s* converted to a list
        s   
t    t   ,s   glob:t    (   t   replacet   splitt
   startswitht   extendR	   t   append(   R   R+   t   resultst   itemt   thisglob(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR      s    
c         C   s   d j  |  S(   s   Convert a list of to a string value.  This does the
        opposite of the :func:`parse` method above.

        :param value: a list of values
        :return: string representation of input
        s   
 (   t   join(   R   R#   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR,      s    N(   R-   R.   R/   R   R   R   R   R,   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR4      s   	t	   UrlOptionc           B   s2   e  Z d  Z d d	 e d  Z d   Z d   Z RS(
   sM   This option handles lists of URLs with validation of the URL
    scheme.
    t   httpt   ftpt   filet   httpsc         C   s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R5   RB   R   t   schemest
   allow_none(   R   R   RG   RH   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR      s    	c         C   s   | j    } | j   d k r: |  j r+ d St d   n  t j |  \ } } } } } } | |  j k r t d |  j   | f   n  | S(   s  Parse a url to make sure that it is valid, and in a scheme
        that can be used.

        :param url: a string containing the url to parse
        :return: *url* if it is valid
        :raises: :class:`ValueError` if there is an error parsing the url
        t   _none_s   "_none_" is not a valid values   URL must be %s not "%s"(   t   stript   lowerRH   R   t   urlparseRG   t   _schemelist(   R   t   urlR+   t   bt   pt   qt   ft   o(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR      s    	!c         C   sb   t  |  j  d k  r d St  |  j  d k r9 |  j d Sd d j |  j d   |  j d f Sd S(   s;   Return a user friendly list of the allowed schemes
        i   t   emptyi    s   %s or %ss   , iN(   t   lenRG   RA   (   R   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRM      s
    N(   RC   RD   s   fileRF   (   R-   R.   R/   R   R   R   R   RM   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRB      s
   	t   ProxyOptionc           B   s   e  Z d  Z d   Z RS(   s4    Just like URLOption but accept "libproxy" too.
    c         C   s,   | j    j   d k r d St j |  |  S(   Nt   libproxy(   RJ   RK   RB   R   (   R   t   proxy(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR      s    (   R-   R.   R/   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRV      s   t   UrlListOptionc           B   s)   e  Z d  Z d d e d  Z d   Z RS(	   sM   Option for handling lists of URLs with validation of the URL
    scheme.
    RC   RD   RE   RF   c         C   s/   t  t |   j | |  t d |  |  _ d  S(   NRG   (   R5   RY   R   RB   t
   _urloption(   R   R   RG   R   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR      s    c         C   s   g  } | j  d d  } | j  d d  } g  t j |  D] } | j  d d  ^ q: } g  } xU | D]M } | j d  r | j  d d  } | j t |   qe n  | j |  qe WxB t t |   j	 d j
 |   D] } | j |  j j	 |   q W| S(   s,  Parse a string containing multiple urls into a list, and
        ensure that they are in a scheme that can be used.

        :param s: the string to parse
        :return: a list of strings containing the urls in *s*
        :raises: :class:`ValueError` if there is an error parsing the urls
        s   
R6   R7   s   %20s   glob:R8   (   R9   t   shlexR:   R;   R<   R	   R=   R5   RY   R   RA   RZ   (   R   R+   t   outR?   t   itemst   tmpR@   RN   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    .(N(   s   https   ftps   files   https(   R-   R.   R/   R   R   R   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRY      s   t   WildListOptionc           B   s   e  Z d  Z d   Z RS(   su   An option containing a list of strings that supports shell-style
    wildcard matching in membership test operations.c         C   s8   d t  f d     Y} t t |   j |  } | |  S(   Nt   WildListc           B   s   e  Z d    Z RS(   c            s-   t    t  s t St   f d   |  D  S(   Nc         3   s!   |  ] } t  j    |  Vq d  S(   N(   t   fnmatch(   t   .0RP   (   R?   (    s.   /usr/lib/python2.7/site-packages/yum/config.pys	   <genexpr>)  s    (   R   R   R   t   any(   R   R?   (    (   R?   s.   /usr/lib/python2.7/site-packages/yum/config.pyt   __contains__&  s    (   R-   R.   Rd   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR`   %  s   (   t   listR5   R_   R   (   R   R+   R`   t   patterns(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   $  s    (   R-   R.   R/   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR_      s   t	   IntOptionc           B   s)   e  Z d  Z d d d d  Z d   Z RS(   s(   An option representing an integer value.c         C   s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R5   Rg   R   t
   _range_mint
   _range_max(   R   R   t	   range_mint	   range_max(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   1  s    	c         C   s   y t  |  } Wn% t t f k
 r7 } t d   n X|  j d k	 re | |  j k re t d   n  |  j d k	 r | |  j k  r t d   n  | S(   s   Parse a string containing an integer.

        :param s: the string to parse
        :return: the integer in *s*
        :raises: :class:`ValueError` if there is an error parsing the
           integer
        s   invalid integer values   out of range integer valueN(   t   intR   t	   TypeErrorRi   R   Rh   (   R   R+   t   valR$   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   6  s    N(   R-   R.   R/   R   R   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRg   .  s   t   PositiveIntOptionc           B   s,   e  Z d  Z d d d d d  Z d   Z RS(   sd   An option representing a positive integer value, where 0 can
    have a special representation.
    i    c         C   s)   t  t |   j | | |  | |  _ d  S(   N(   R5   Ro   R   t   _names0(   R   R   Rj   Rk   t
   names_of_0(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   L  s    c         C   s)   | |  j  k r d St t |   j |  S(   s  Parse a string containing a positive integer, where 0 can
           have a special representation.

        :param s: the string to parse
        :return: the integer in *s*
        :raises: :class:`ValueError` if there is an error parsing the
           integer
        i    (   Rp   R5   Ro   R   (   R   R+   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   Q  s    	N(   R-   R.   R/   R   R   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRo   H  s   	t   SecondsOptionc           B   s9   e  Z d  Z i d
 d 6d d 6d d 6d d 6Z d   Z RS(   s  An option representing an integer value of seconds, or a human
    readable variation specifying days, hours, minutes or seconds
    until something happens. Works like :class:`BytesOption`.  Note
    that due to historical president -1 means "never", so this accepts
    that and allows the word never, too.

    Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never.
    Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.

    Return value will always be an integer
    i<   i   t   dt   ht   mi   R+   c         C   s  t  |  d k  r! t d   n  | d k s9 | d k r= d S| d j   r | d  } | d j   } |  j j | d
  } | s t d |   q n | } d } y t |  } Wn% t t f k
 r } t d   n X| d k  r t d	   n  t	 | |  S(   s  Parse a string containing an integer value of seconds, or a human
        readable variation specifying days, hours, minutes or seconds
        until something happens. Works like :class:`BytesOption`.  Note
        that due to historical president -1 means "never", so this accepts
        that and allows the word never, too.
    
        Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never.
        Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.
    
        :param s: the string to parse
        :return: an integer representing the number of seconds
           specified by *s*
        :raises: :class:`ValueError` if there is an error parsing the string
        i   s   no value specifieds   -1t   neveris   unknown unit '%s's   invalid valuei    s!   seconds value may not be negativeN(
   RU   R   t   isalphaRK   t   MULTSt   getR   t   floatRm   Rl   (   R   R+   t   nt   unitt   multR$   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   l  s&    
i  iQ i  (   R-   R.   R/   Rx   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRr   ^  s   "t
   BoolOptionc           B   s    e  Z d  Z d   Z d   Z RS(   sh   An option representing a boolean value.  The value can be one
    of 0, 1, yes, no, true, or false.
    c         C   s<   | j    } | d	 k r t S| d
 k r, t St d   d S(   s  Parse a string containing a boolean value.  1, yes, and
        true will evaluate to True; and 0, no, and false will evaluate
        to False.  Case is ignored.
        
        :param s: the string containing the boolean value
        :return: the boolean value contained in *s*
        :raises: :class:`ValueError` if there is an error in parsing
           the boolean value
        t   0t   not   falset   1t   yest   trues   invalid boolean valueN(   R   R   R   (   R   s   yesR   (   RK   R   R0   R   (   R   R+   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    
c         C   s   | r
 d Sd Sd S(   s   Convert a boolean value to a string value.  This does the
        opposite of the :func:`parse` method above.
        
        :param value: the boolean value to convert
        :return: a string representation of *value*
        R   R   N(    (   R   R#   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR,     s    (   R-   R.   R/   R   R,   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR~     s   	t   FloatOptionc           B   s   e  Z d  Z d   Z RS(   s-   An option representing a numeric float value.c         C   s>   y t  | j    SWn# t t f k
 r9 t d   n Xd S(   s  Parse a string containing a numeric float value.

        :param s: a string containing a numeric float value to parse
        :return: the numeric float value contained in *s*
        :raises: :class:`ValueError` if there is an error parsing
           float value
        s   invalid float valueN(   Rz   RJ   R   Rm   (   R   R+   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    (   R-   R.   R/   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s   t   SelectionOptionc           B   s)   e  Z d  Z d d i  d  Z d   Z RS(   sF   Handles string values where only specific values are
    allowed.
    c         C   s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R5   R   R   t   _allowedt   _mapper(   R   R   t   allowedt   mapper(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    	c         C   sE   | |  j  k r |  j  | } n  | |  j k rA t d |   n  | S(   s   Parse a string for specific values.

        :param s: the string to parse
        :return: *s* if it contains a valid value
        :raises: :class:`ValueError` if there is an error parsing the values
        s   "%s" is not an allowed value(   R   R   R   (   R   R+   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s
    N(    (   R-   R.   R/   R   R   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s   t   CaselessSelectionOptionc           B   s   e  Z d  Z d   Z RS(   sv   Mainly for compatibility with :class:`BoolOption`, works like
    :class:`SelectionOption` but lowers input case.
    c         C   s   t  t |   j | j    S(   s   Parse a string for specific values.

        :param s: the string to parse
        :return: *s* if it contains a valid value
        :raises: :class:`ValueError` if there is an error parsing the values
        (   R5   R   R   RK   (   R   R+   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    (   R-   R.   R/   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s   t   BytesOptionc           B   s2   e  Z d  Z i d d 6d d 6d d 6Z d   Z RS(	   sv   An option representing a value in bytes. The value may be given
    in bytes, kilobytes, megabytes, or gigabytes.
    i   t   kRu   t   gc         C   s   t  |  d k  r! t d   n  | d j   r| | d  } | d j   } |  j j | d  } | s t d |   q n | } d } y t |  } Wn! t k
 r t d |   n X| d k  r t d   n  t | |  S(	   sF  Parse a friendly bandwidth option to bytes.  The input
        should be a string containing a (possibly floating point)
        number followed by an optional single character unit. Valid
        units are 'k', 'M', 'G'. Case is ignored. The convention that
        1k = 1024 bytes is used.
       
        Valid inputs: 100, 123M, 45.6k, 12.4G, 100K, 786.3, 0.
        Invalid inputs: -10, -0.1, 45.6L, 123Mb.

        :param s: the string to parse
        :return: the number of bytes represented by *s*
        :raises: :class:`ValueError` if the option can't be parsed
        i   s   no value specifiedis   unknown unit '%s's   couldn't convert '%s' to numberi    s   bytes value may not be negativeN(	   RU   R   Rw   RK   Rx   Ry   R   Rz   Rl   (   R   R+   R{   R|   R}   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s"    
i   i   i   @(   R-   R.   R/   Rx   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s   
t   ThrottleOptionc           B   s   e  Z d  Z d   Z RS(   sj   An option representing a bandwidth throttle value. See
    :func:`parse` for acceptable input values.
    c         C   s   t  |  d k  r! t d   n  | d d k r | d  } y t |  } Wn! t k
 rn t d |   n X| d k  s | d k r t d   n  | d	 St j |  |  Sd
 S(   s(  Get a throttle option. Input may either be a percentage or
        a "friendly bandwidth value" as accepted by the
        :class:`BytesOption`.

        Valid inputs: 100, 50%, 80.5%, 123M, 45.6k, 12.4G, 100K, 786.0, 0.
        Invalid inputs: 100.1%, -4%, -500.

        :param s: the string to parse
        :return: the bandwidth represented by *s*. The return value
           will be an int if a bandwidth value was specified, and a
           float if a percentage was given
        :raises: :class:`ValueError` if input can't be parsed
        i   s   no value specifiedit   %s   couldn't convert '%s' to numberi    id   s   percentage is out of rangeg      Y@N(   RU   R   Rz   R   R   (   R   R+   R{   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    
(   R-   R.   R/   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s   t
   BaseConfigc           B   s   e  Z d  Z d   Z d   Z d d  Z e d  Z e	 e  Z d   Z
 e	 e
  Z
 d   Z d   Z d d d  Z d d	  Z d
   Z RS(   sg   Base class for storing configuration definitions. Subclass when
    creating your own definitions.
    c         C   sC   d  |  _ x3 |  j   D]% } |  j |  } | j |  |  q Wd  S(   N(   R   t   _sectiont   iterkeyst	   optionobjR(   (   R   R'   t   option(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   A  s    	c         C   s[   g  } | j  d |  j  x1 |  j   D]# \ } } | j  d | | f  q' Wd j |  S(   Ns   [%s]s   %s: %rs   
(   R=   R   t	   iteritemsRA   (   R   R\   R'   R#   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   __str__H  s
    c         C   s   | |  _  | |  _ | j |  r9 t | j |   } n	 t   } x |  j   D]| } |  j |  } d } | | k r | j | |  } n! | r | j	 r t
 | |  } n  | d k	 rO t |  | |  qO qO Wd S(   sC  Set option values from an INI file section.

        :param parser: :class:`ConfigParser` instance (or subclass)
        :param section: INI file section to read use
        :param parent: Optional parent :class:`BaseConfig` (or
            subclass) instance to use when doing option value
            inheritance
        N(   t   cfgR   t   has_sectiont   sett   optionsR   R   R   Ry   R   R   R"   (   R   t   parsert   sectiont   parentt   optsR'   R   R#   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   populateO  s    				c         C   s<   t  |  | d  } t | t  r% | S| r4 t  n d Sd S(   s  Return the :class:`Option` instance for the given name.

        :param cls: the class to return the :class:`Option` instance from
        :param name: the name of the :class:`Option` instance to return
        :param exceptions: defines what action to take if the
           specified :class:`Option` instance does not exist. If *exceptions* is
           True, a :class:`KeyError` will be raised. If *exceptions*
           is False, None will be returned
        :return: the :class:`Option` instance specified by *name*, or None if
           it does not exist and *exceptions* is False
        :raises: :class:`KeyError` if the specified :class:`Option` does not
           exist, and *exceptions* is True
        N(   R   R   R   R   t   KeyError(   t   clsR'   t
   exceptionsR   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   l  s    	c         C   s   |  j  | d t d k	 S(   s   Return True if the given name refers to a defined option.

        :param cls: the class to find the option in
        :param name: the name of the option to search for
        :return: whether *name* specifies a defined option
        R   N(   R   R   R   (   R   R'   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   isoption  s    c         c   s2   x+ t  |   D] } |  j |  r | Vq q Wd S(   s7   Yield the names of all defined options in the instance.N(   t   dirR   (   R   R'   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    c         c   s/   x( |  j    D] } | t |  |  f Vq Wd S(   s   Yield (name, value) pairs for every option in the
        instance. The value returned is the parsed, validated option
        value.
        N(   R   R   (   R   R'   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    c      	   C   s   | d k r6 |  j d k r* t d   n  |  j } n  |  j j |  } x~ |  j   D]p \ } } |  j |  } | d k s | | k s | j | k s | | k rU |  j j | | | j	 |   qU qU W|  j j
 |  d S(   s  Write out the configuration to a file-like object.

        :param fileobj: File-like object to write to
        :param section: Section name to use. If not specified, the section name
            used during parsing will be used
        :param always: A sequence of option names to always write out.
            Options not listed here will only be written out if they are at
            non-default values. Set to None to dump out all options
        s!   not populated, don't know sectionN(   R   R   R   R   R   R   R   R   R   R,   t   write(   R   t   fileobjR   t   alwayst
   cfgOptionsR'   R#   R   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    3&c         C   s0   t  j d t  t |  |  r, t |  |  S| S(   sC  Return the current value of the given option.

        :param option: string specifying the option to return the
           value of
        :param default: the value to return if the option does not exist
        :return: the value of the option specified by *option*, or
           *default* if it does not exist
        sx   getConfigOption() will go away in a future version of Yum.
Please access option values as attributes or using getattr().(   t   warningst   warnt   DeprecationWarningt   hasattrR   (   R   R   R   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   getConfigOption  s
    		c         C   sF   t  j d t  t |  |  r2 t |  | |  n t j d |  d S(   s   Set the value of the given option to the given value.

        :param option: string specifying the option to set the value
           of
        :param value: the value to set the option to
        su   setConfigOption() will go away in a future version of Yum.
Please set option values as attributes or using setattr().s   No such option %sN(   R   R   R   R   R"   t   Errorst   ConfigError(   R   R   R#   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   setConfigOption  s
    	N(    (   R-   R.   R/   R   R   R   R   R0   R   t   classmethodR   R   R   R   R   R   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR   <  s   						t   StartupConfc           B   s   e  Z d  Z e d d d  Z e d d d  Z e d d g  Z e d  Z	 e d  Z
 e e  Z e d	 d
 g  Z e d g  Z e e  Z e   Z e d  Z e d  Z e d  Z e e  Z e e  Z RS(   s   Configuration option definitions for yum.conf's [main] section
    that are required early in the initialisation process or before
    the other [main] options can be parsed.
    i   ii
   i    s   system-release(releasever)s   redhat-releaset   /s   /etc/yum/yum.confs   /usr/share/yum-pluginss   /usr/lib/yum-pluginss   /etc/yum/pluginconf.dt   LOG_USERs   /dev/logs   /var/lib/yum(   R-   R.   R/   Rg   t
   debuglevelt
   errorlevelR4   t   distroverpkgR   t   installroott   config_file_pathR~   R   t   pluginst
   pluginpatht   pluginconfpatht
   gaftonmodet   syslog_identt   syslog_facilityt   syslog_devicet
   persistdirR0   t   skip_missing_names_on_installt   skip_missing_names_on_update(    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    	t   YumConfc           B   s  e  Z d  Z e d d d g Z e d d d Z e e  Z	 e
 d  Z e e  Z e e  Z e
 d  Z e d	 d
 g  Z e   Z e   Z e
 e  Z e d e d dl d e  Z e
   Z e
   Z e
   Z e
   Z e d d d d d d d d d d d d  d! g  Z e e d d" d d# d$ g Z e d d d d d% d  d! g  Z e  e!  Z" e   Z# e
   Z$ e e  Z% e e  Z& e e  Z' e e  Z( e e  Z) e e  Z* e e  Z+ e e  Z, e e-  Z. e e/  Z0 e e-  Z1 e e2  Z3 e e  Z4 e e  Z5 e e  Z6 e e  Z7 e e  Z8 e e  Z9 e e  Z: e e  Z; e d& d g  Z< e= e> dm  Z? e e  Z@ eA d*  ZB e d  ZC eD d  ZE eF d  ZG eH d+ dn d/ i d, d0 6d- d1 6 ZI e d d d ZJ e e  ZK e d" d d2 d3 d4 ZL e d5 d d d3 d6 ZM e d6 d d ZN e= d7 do  ZO eP dq  ZQ e= d= dr  ZR eP dt  ZS e e  ZT e   ZU e e  ZV e e  ZW e dB g  ZX e= dC du  ZY e= eZ dv  Z[ e
 dF  Z\ e= dG dw d/ i
 dH dI 6dH dJ 6dH dK 6dH dL 6d> dM 6d> dN 6d> d# 6d> dO 6dG dP 6dG dQ 6Z] e
 dR  Z^ e
 dS  Z_ e
 dT  Z` e
 dU  Za e
 dV  Zb e
 dW  Zc e
 dX  Zd e
 dY  Ze e
 dT  Zf e
 dV  Zg e
 dT  Zh e
 dR  Zi e
 dT  Zj e
 dR  Zk e dZ d[ g  Zl e
   Zm e e  Zn e
   Zo e
   Zp e e  Zq e e  Zr e d\ d] g  Zs e
 d^  Zt e d_ d` e Zu e e  Zv e e  Zw e e  Zx e e  Zy e e  Zz e e  Z{ e e  Z| e e  Z} e= da dx d/ i dc dd 6da d 6Z~ e e  Z e e  Z e e  Z e de  Z e d6 d de d3 d6 Z e df d` e Z e= dg dy  Z e d6 d d g Z e e  Z e e  Z e e  Z e= d# dz  Z g  Z d{ Z dk   Z RS(|   s   Configuration option definitions for yum.conf's [main] section.

    Note: see also options inherited from :class:`StartupConf`
    i
   Rq   s	   <forever>i   Rj   i    s   /var/cache/yums   /var/log/yum.logs   /etc/yum/repos.ds   /etc/yum.repos.dR   RG   RC   RD   RF   t   socks4t   socks4at   socks5t   socks5hRH   t   kernels   kernel-bigmems   installonlypkg(kernel)s   installonlypkg(kernel-module)s   installonlypkg(vm)s   kernel-enterprises
   kernel-smps   kernel-debugs   kernel-unsupporteds   kernel-sources   kernel-devels
   kernel-PAEs   kernel-PAE-debugi   R   s   <off>s   kernel-BOOTt	   mandatoryt   compatR   t   simpleg      >@R   t   ipv4t   ipv6t   whateverR   t   4t   6iRk   i   iK   id   t   allt   nonet   packagess   lazy:packagesi<   i   s   read-only:presentRv   s   read-only:futures   read-only:pasti   s   group:smallt   sqlitet   xmlR
   sV   https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&version=rawhide&component=yumt   autoR   t   onR   R   R   t   offR   R   t   ttys   if-ttyt   bolds   bold,yellowt   normals   bold,reds   bold,underlines	   bold,blues   dim,cyans   bold,underline,greent
   releasevert   basearcht   yumt   rpmt   infos%   yum, glob:/etc/yum/protected.d/*.confR   s   single-user-commandst   userst   commandst   cmdsi   s0   !*/swap !*/lv_swap glob:/etc/yum/fssnap.d/*.confRc   s   broken-setups   snapshot-failuret   ?c         C   s   d } d } x t  |   D] } | j d
  r4 q n  | | k rF q n  t t |  |  t j  rg q n  t |  |  } | r t |  t t  t d  f k r d } n  t |  t j k r d j	 |  } n  | d | | f } q W| S(   s   Return a string representing the values of all the
        configuration options.

        :return: a string representing the values of all the
           configuration options
        s   [main]
R   t   uidt   yumvart   progress_objt   failure_objt   disable_excludest   config_file_ageR   t   _i    R8   s   ,
   s   %s = %s
(   s   cfgs   uids   yumvarR   R   s   disable_excludess   config_file_ages   config_file_path(
   R   R;   R   R   t   typest
   MethodTypet   typeR   t   ListTypeRA   (   R   t   outputt   excluded_varst   attrt   res(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   dump  s"     +	(   s   https   ftps   httpsR   R   R   R   (   R   R   R   (   R   R   R   (   R   R   s   alls   lazy:packagesi  i`T  (   s   nevers   read-only:futures   read-only:presents   read-only:pasti  iQ (   R   R   (   R
   s   all(   R   s   nevers   always(   s   single-user-commandsR   s   commands(   s   broken-setups   snapshot-failures   anyR   (   R   R   N(   R-   R.   R/   Ro   t   retriesRg   t   recentR~   R0   t
   reset_niceR   t   cachedirt	   keepcachet	   usercachet   logfileR4   t   reposdirR   t   excludet   __main_failovermethod_default__t   failovermethodRV   R   RX   t   proxy_usernamet   proxy_passwordt   usernamet   passwordt   installonlypkgst"   __main_installonly_limit_default__t   installonly_limitt   kernelpkgnamesR_   t   __exactarchlist_default__t   exactarchlistt   tsflagst   override_install_langst	   assumeyest   assumenot   alwayspromptt	   exactarcht   tolerantt   diskspacecheckt   overwrite_groupst	   keepalivet   __pkgs_gpgcheck_default__t   gpgcheckt   __repo_gpgcheck_default__t   repo_gpgcheckt   localpkg_gpgcheckt   __payload_gpgcheck_default__t   payload_gpgcheckt	   obsoletest   showdupesfromrepost   enabledt   remove_leaf_onlyt   repopkgsremove_leaf_onlyt   enablegroupst   enable_group_conditionalst   groupremove_leaf_onlyt   group_package_typesR   t   __group_command_default__t   group_commandt   upgrade_group_objects_upgradeR   t   timeoutt   minrateR   t	   bandwidthR   t   throttleR   t
   ip_resolvet   max_connectionst   ftp_disable_epsvt   deltarpmt   deltarpm_percentaget   deltarpm_metadata_percentaget   http_cachingRr   t   metadata_expiret   metadata_expire_filtert   mirrorlist_expiret   rpm_check_debugR   t   query_install_excludest   skip_brokent   mdpolicyt   mddownloadpolicyt    __main_multilib_policy_default__t   multilib_policyt   bugtracker_urlt   colort   color_list_installed_oldert   color_list_installed_newert   color_list_installed_reinstallt   color_list_installed_extrat#   color_list_installed_running_kernelt   color_list_available_upgradet   color_list_available_downgradet   color_list_available_reinstallt   color_list_available_installt#   color_list_available_running_kernelt   color_update_installedt   color_update_localt   color_update_remotet   color_search_matcht   ui_repoid_varst	   sslcacertt	   sslverifyt   sslclientcertt   sslclientkeyt   ssl_check_cert_permissionst   history_recordt   history_record_packagest   rpmverbosityt   protected_packagest   protected_multilibt   exit_on_lockt   loadts_ignoremissingt   loadts_ignorerpmt   loadts_ignorenewrpmt
   autosavetst   clean_requirements_on_removet   upgrade_requirements_on_installt   history_list_viewt   recheck_installed_requirest   fssnap_automatic_pret   fssnap_automatic_postt   fssnap_automatic_keept   fssnap_percentaget   fssnap_devicest   fssnap_abort_on_errorst   depsolve_loop_limitt   autocheck_running_kernelt   check_config_file_aget   usr_w_checkt   shell_exit_statust
   _reposlistR   t   _pristine_cachedirR   (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s$  													  								 
		t   RepoConfc           B   s  e  Z d  Z e   Z d   Z e   Z e e	 j
  Z
 e e	 j  Z e   Z e   Z e   Z e   Z e   Z e   Z e   Z e   Z e e	 j  Z e e	 j  Z e e	 j  Z e e	 j  Z e e	 j  Z e e	 j  Z e e	 j  Z e e	 j  Z e e	 j  Z e e	 j   Z  e e	 j!  Z! e e	 j"  Z" e e	 j#  Z# e e	 j$  Z$ e e	 j%  Z% e e	 j&  Z& e' d
 d d d d Z) e e	 j*  Z* e e	 j+  Z+ e e	 j,  Z, e e	 j-  Z- e e	 j.  Z. e e	 j/  Z/ e e	 j0  Z0 e e	 j1  Z1 e' d  Z2 e e	 j3  Z3 e e	 j4  Z4 e e	 j5  Z5 e e	 j6  Z6 e e	 j7  Z7 e8 e9  Z: e8 e;  Z< e e	 j=  Z= e e	 j>  Z> e' d d d d d	 Z? RS(   s4   Option definitions for repository INI file sections.c         c   sf   |  j  } t |  t  s$ t   } n  | sI | j t t j |     n  x |  j  D] } | VqS Wd S(   s7   Yield the names of all defined options in the instance.N(   t   _RepoConf__cached_keysR   Ro  R   t   updateRe   R   R   (   R   t   ckR'   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR     s    	Rj   i    Rk   id   i  iP   i   ic   N(@   R-   R.   R/   R   Rp  R   R   R'   R3   R   R  R   RY   t   baseurlRB   t
   mirrorlistt   metalinkt   mediaidt   gpgkeyt   gpgcakeyR4   R   t   includepkgsRX   R  R  R   R  R  R  R  R  R  R"  R*  R+  R,  R)  R-  Rg   R   R1  R2  R/  R3  R4  R5  R6  R:  R;  t   costRO  RP  RQ  RR  RS  R~   R   t   skip_if_unavailableR0   t   asyncRN  Rj  t   compare_providers_priority(    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyRo    sd   											t   VersionGroupConfc           B   s#   e  Z d  Z e   Z e e  Z RS(   s&   Option definitions for version groups.(   R-   R.   R/   R4   t   pkglistR~   R   t   run_with_packages(    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR~    s   	c         C   s   y | d } t  j |  } Wn t k
 r6 g  } n Xx | D] } t  j j | |  r` q> n  y= t | |  j   } | r | d d k r | d  } n  Wn t t f k
 r q> n X| |  | <q> Wd  S(   Ns   /etc/yum/vars/is   
(   t   ost   listdirt   OSErrort   patht   islinkt   opent   readlinet   IOError(   t   yumvarst   roott
   dir_fsvarst   fsvarst   fsvarRn   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   _read_yumvars   s    

c   
      C   s=  | t  j _ t    } |  | _ t   } t |   } t   } t | | j  | | _ | | _	 y | j
 |  Wn& t k
 r } t j d |   n X| j | d  x3 | j D]( } | d d k s t j d   q q W| | _ | d k rt | j | j  } n  | | _ d | j | j f }	 t |	  | _ | S(   s  Parse Yum's main configuration file and return a
    :class:`StartupConf` instance.  This is required in order to
    access configuration settings required as Yum starts up.

    :param configfile: the path to yum.conf
    :param root: the base path to use for installation (typically '/')
    :return: A :class:`StartupConf` instance

    :raises: :class:`Errors.ConfigError` if a problem is detected with while parsing.
    s   Parsing file failed: %st   maini    R   s(   All plugin search paths must be absolutes
   %s/%s/uuidN(   R   R   R   R   R   R    t
   _getEnvVarR  t   _varsR  t   readfpR   R   R   R   R   t   _parserR   t
   _getsysverR   R   R   R   t   uuid(
   t
   configfileR  R   t   startupconfR   t
   confpp_objR  R$   R  t   uuidfile(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   readStartupConfig2  s2    									c            sX  |  j      j d |  j    j d |  j    j d |  j    j d |  j  t   } | j |  j d  | j	 | _
   f d   } t j j | j k r t   | j  n  x d D] } | | |  q W  | _ d
 | _ d
 | _ d | _ |  j | _ t j j |  j  r3t j |  j  d | _ n	 d
 | _ |  j | _ |  j | _ | S(   s   Parse Yum's main configuration file

    :param startupconf: :class:`StartupConf` instance as returned by readStartupConfig()
    :return: Populated :class:`YumConf` instance
    R   t   archR   R  R  c            sQ   t  |  |  } |  j | } | j d d  } t |    } t |  | |  d  S(   Ns   //R   (   R   R   R9   R   R"   (   t   yumconfR   R  t   ir_path(   R  (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   _apply_installroot{  s
    R   R   R   i    i   (   s   cachedirs   logfiles
   persistdirN(   R  t
   setdefaultR   R  R   R  R   R   R  R   Rn  R   R   R   R  R   R   t   cacheR   t   progess_objR   R  R  t   existst   statR   R   R   (   R  R  R  R   (    (   R  s.   /usr/lib/python2.7/site-packages/yum/config.pyt   readMainConfigc  s0    
							s   /etc/yum/version-groups.confc         C   s   t    } t |   } y | j |  Wn& t k
 rN } t j d |   n Xi  } x5 | j   D]' } t   | | <| | j | |  qb W| S(   s   Parse the configuration file for version groups.
    
    :param configfile: the configuration file to read
    :return: a dictionary containing the parsed options
    s   Parsing file failed: %s(	   R   R    R  R   R   R   t   sectionsR~  R   (   R  R   R  R$   t   retR   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   readVersionGroupsConfig  s    	c         C   sA   y |  j  | |  } Wn t t f k
 r3 | j SX| j |  S(   s  Convenience function to retrieve a parsed and converted value from a
    :class:`ConfigParser`.

    :param conf: ConfigParser instance or similar
    :param section: Section name
    :param name: :class:`Option` name
    :param option: :class:`Option` instance to use for conversion
    :return: The parsed value or default if value was not present
    :raises: :class:`ValueError` if the option could not be parsed
    (   Ry   R   R   R   R   (   t   confR   R'   R   Rn   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt	   getOption  s
    c          C   s\   i  }  xO t  d d  D]> } d | } t j j | d  } | r | |  | j   <q q W|  S(   s   Return variable replacements from the environment variables YUM0 to YUM9

    The result is intended to be used with parser.varReplace()
    i    i
   s   YUM%dR8   (   t   rangeR  t   environRy   RK   (   R   t   numt   envRn   (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR    s    
c         C   s	  t  j j d |   } | j t j t j B y7 x0 | D]( } | j d |  } | j   r7 Pq7 q7 WWn t	 k
 r } t
 j d k  r t | d  r t j d t | j    q t j d t |    n  t j d t |    n/ t j k
 r} t j d t |    n X| j   d k r5d } n y | j   } Wn  t k
 rgt j d   n X| d	 } | t t d
  j |  } | t t d  | }	 t  j j |	  }	 | t t d  | }
 |	 d k r|
 r| d | k r|
 } qn  ~ ~ ~ | S(   s   Calculate the release version for the system.

    @param installroot: The value of the installroot option.
    @param distroverpkg: The value of the distroverpkg option.
    @return: The release version as a string (eg. '4' for FC4)
    R  t   providesi  t   messages   Error: i    s   $releasevers:   Error: rpmdb failed release provides. Try: rpm --rebuilddbt   versiont   RPMTAG_PROVIDENAMEt   RPMTAG_PROVIDEFLAGSt   RPMTAG_PROVIDEVERSIONt   EQR'   (   t   rpmUtilst   transactiont   initReadOnlyTransactiont   pushVSFlagsR   t   _RPMVSF_NOSIGNATURESt   _RPMVSF_NODIGESTSt   dbMatcht   countRm   t   syst
   hexversionR   R   t   YumBaseErrorR!   R  t   errort   nextt   StopIterationR   t   indext	   miscutilst   flagToString(   R   R   t   tst   distroverpkg_provt   idxR$   R   t   hdrR   t   flagt   ver(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyR    sB    	
c         C   s   t  s
 d  St |  d  s$ |  j r( d  Sy t t |  j   } Wn d  SX|  j } |  j | j k r xC | j j   D]+ } t	 | |  j
  |  j k rw | } Pqw qw Wd  Sn  | | f S(   Nt   repofile(   t   _use_iniparseR   R   R  R   R  R   t	   _sectionst   keysR   R   (   t   repot   init
   section_idt   sect(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   _readRawRepoFile  s     	c   
      C   s?  t  s
 d St |   \ } } |  j j |  j  } x |  j   D] \ } } | d k r\ q> n  | d k	 rz | | k rz q> n  |  j |  } | j |  } | | | k r | t	 | | | |  j
  k r | | | } n  | | k r | j | k r q> n  | | | | <q> Wt |  j d  }	 |	 j t |   |	 j   d S(   s   Write changes in a repo object back to a .repo file.

    :param repo: the Repo Object to write back out
    :param only: list of attributes to work on. If *only* is None, all
       options will be written out   
    Nt   w(   R  R  R   R   R   R   R   R   R,   R   R   R   RE   R  R   R!   t   close(
   R  t   onlyR  R  R   R'   R#   R   t   ovaluet   fp(    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   writeRawRepoFile  s(     c         C   sp  t  t |    } | } | | j k rb x8 | j j   D]$ }	 t |	 |  | k r7 |	 } q7 q7 Wn  | |  }
 x |   D] \ } } | d k r qx n  | d k	 r | | k r qx n  | |  } | j |  } | | | k r| t | | | |  k r| | | } n  | |
 k r.| j | k r.qx n  | | | | <qx Wt |  d  } | j	 t
 |   | j   d S(   s@   
    From writeRawRepoFile, but so we can alter [main] too.
    R  N(   R   R  R  R  R   R   R,   R   RE   R   R!   R  (   t   filenameR  R   t
   cfgoptionsR]   R   R  R  t   osection_idR  R   R'   R#   R   R  R  (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   _writeRawConfigFileD  s.    (I   R/   R0   R  R  R  R   R   R&   RL   R[   R   R    R   t   iniparseR   t   iniparse.compatR   R   R   R   R   t   ImportErrorR   t   rpmUtils.transactionR  t   rpmUtils.miscutilsR   R   t   miscR   R	   Ra   R  R  R  R<  R   R  R&  R
  t   objectR   R3   R4   RB   RV   RY   R_   Rg   Ro   Rr   R~   R   R   R   R   R   R   R   R   Ro  R~  R  R   R  R  R  R  R  R  R  R  R  (    (    (    s.   /usr/lib/python2.7/site-packages/yum/config.pyt   <module>   s~   
Z	'-$6#0"Q	1	>			3	(