ó
X¾÷Xc           @   s‹   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z y d  d l Z Wn e k
 rk d  d l Z n Xe  j d „  ƒ Z	 d „  Z
 d S(   iÿÿÿÿNc         c   se   t  j d k r t j ƒ  } n t j ƒ  } | j |  ƒ | Vt |  d ƒ  } | j | ƒ Wd  QXd  S(   Ni   i   t   w(   i   i   (   t   syst   version_infot   configparsert   ConfigParsert   SafeConfigParsert   readt   opent   write(   t   filenamet   cfgt   fp(    (    s+   /tmp/pip-build-h1VYrz/pbr/pbr/tests/util.pyt   open_config5   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(    (    s+   /tmp/pip-build-h1VYrz/pbr/pbr/tests/util.pyt   onerrorG   s    R   (   t   shutilt   rmtree(   R   R   (    (    s+   /tmp/pip-build-h1VYrz/pbr/pbr/tests/util.pyR   A   s    	(   t
   contextlibR   R   R   R   R   R   t   ImportErrort   contextmanagerR   R   (    (    (    s+   /tmp/pip-build-h1VYrz/pbr/pbr/tests/util.pyt   <module>)   s   