ó
£„öUc           @   s   d  d l  Z  d  d l Z d  d l Z d  d l Z y d  d l Z Wn e k
 r_ d  d l Z n Xe  j d „  ƒ Z d „  Z	 d S(   iÿÿÿÿNc         c   sG   t  j ƒ  } | j |  ƒ | Vt |  d ƒ  } | j | ƒ Wd  QXd  S(   Nt   w(   t   configparsert   SafeConfigParsert   readt   opent   write(   t   filenamet   cfgt   fp(    (    s2   /usr/lib/python2.7/dist-packages/pbr/tests/util.pyt   open_config4   s
    c         C   s   d „  } t  j |  d | ƒS(   sk   shutil.rmtree() with error handler.

    Handle 'access denied' from trying to delete read-only files.
    c         S   s<   t  j | t  j ƒ s5 t  j | t j ƒ |  | ƒ n ‚  d  S(   N(   t   ost   accesst   W_OKt   chmodt   statt   S_IWUSR(   t   funct   patht   exc_info(    (    s2   /usr/lib/python2.7/dist-packages/pbr/tests/util.pyt   onerrorC   s    R   (   t   shutilt   rmtree(   R   R   (    (    s2   /usr/lib/python2.7/dist-packages/pbr/tests/util.pyR   =   s    	(
   t
   contextlibR
   R   R   t   ConfigParserR   t   ImportErrort   contextmanagerR	   R   (    (    (    s2   /usr/lib/python2.7/dist-packages/pbr/tests/util.pyt   <module>)   s   	