MINI MINI MANI MO
ó
ľ˘ß[c           @   sk   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z e  j d  Z d   Z d d d     YZ	 d S(   i˙˙˙˙Ns   \$(\w+)c         C   sˇ   | s
 |  Sg  } x |  rŠ t  j |   } | s? | j |   Pn  | j d  j   } | j | | j    } | j   \ } } | j |  |   | j |  |  | }  q Wd j |  S(   s  Perform variable replacement
    @param raw: String to perform substitution on.  
    @param vars: Dictionary of variables to replace. Key is variable name
        (without $ prefix). Value is replacement string.
    @return: Input raw string with substituted values.
    i   t    (   t   _KEYCREt   searcht   appendt   groupt   lowert   gett   spant   join(   t   rawt   varst   donet   mt   varnamet   replacementt   startt   end(    (    s.   /usr/lib/python2.7/site-packages/yum/parser.pyt
   varReplace   s    		
t   ConfigPreProcessorc           B   sS   e  Z d  Z d	 d  Z d d  Z d   Z d   Z d   Z d   Z	 d   Z
 RS(
   sĄ  
    ConfigParser Include Pre-Processor
    File-like Object capable of pre-processing include= lines for
    a ConfigParser. 
    The readline function expands lines matching include=(url)
    into lines from the url specified. Includes may occur in
    included files as well. 
    Suggested Usage::
        cfg = ConfigParser.ConfigParser()
        fileobj = confpp( fileorurl )
        cfg.readfp(fileobj)
    c         C   sŇ   | |  _  d  |  _ d |  _ t j |  d } | d k r | d d k r{ y t j   d } Wn
 d } n X| | } n  d | } n | } g  |  _ g  |  _ |  j	 |  } | d  k rÎ t
 j d |  n  d  S(   Nt   ri    R    t   /s   file://s   Error accessing file: %s(   t   _varst   Nonet   _sectiont   modet   urlparset   ost   getcwdt	   _incstackt   _alreadyincludedt	   _pushfilet   Errorst   ConfigError(   t   selft
   configfileR
   t   schemet   rootdirt   urlt   fo(    (    s.   /usr/lib/python2.7/site-packages/yum/parser.pyt   __init__=   s$    			
		i    c         C   s2  d } xň t  |  j  d k rú |  j d } | j   } t  |  d k rí t j d |  } | rź | j d  } t  |  d k r t j d |  j  qę t	 | |  j
  } |  j |  } q÷ t j d |  } | ré | j d  |  _ n  Pq	 |  j
   q	 Wt j d	 |  } | r"| j   } n  t	 | |  j
  S(
   sÖ  
        Implementation of File-Like Object readline function. This should be
        the only function called by ConfigParser according to the python docs.
        We maintain a stack of real FLOs and delegate readline calls to the 
        FLO on top of the stack. When EOF occurs on the topmost FLO, it is 
        popped off the stack and the next FLO takes over. include= lines 
        found anywhere cause a new FLO to be opened and pushed onto the top 
        of the stack. Finally, we return EOF when the bottom-most (configfile
        arg to __init__) FLO returns EOF.
        
        Very Technical Pseudo Code::
        
            def confpp.readline() [this is called by ConfigParser]
                open configfile, push on stack
                while stack has some stuff on it
                    line = readline from file on top of stack
                    pop and continue if line is EOF
                    if line starts with 'include=' then
                        error if file is recursive or duplicate
                        otherwise open file, push on stack
                        continue
                    else
                        return line
                
                return EOF
        R    i    i˙˙˙˙s   \s*include\s*=\s*(?P<url>.*)R%   s>