U
    jPŒ^f
  ã                   @   sl   d dl Z d dlZd dlZd dlZd dlZzd dlZW n ek
rP   d dlZY nX e jdd„ ƒZ	dd„ Z
dS )é    Nc              	   c   sP   t jdkrt ¡ }nt ¡ }| | ¡ |V  t| dƒ}| |¡ W 5 Q R X d S )N)é   é   Úw)ÚsysÚversion_infoÚconfigparserÚConfigParserZSafeConfigParserÚreadÚopenÚwrite)ÚfilenameZcfgÚfp© r   ú0/usr/lib/python3/dist-packages/pbr/tests/util.pyÚopen_config5   s    


r   c                 C   s   dd„ }t j| |dS )zkshutil.rmtree() with error handler.

    Handle 'access denied' from trying to delete read-only files.
    c                 S   s,   t  |t j¡s&t  |tj¡ | |ƒ n‚ d S )N)ÚosÚaccessÚW_OKÚchmodÚstatÚS_IWUSR)ÚfuncÚpathÚexc_infor   r   r   ÚonerrorG   s    
zrmtree.<locals>.onerror)r   )ÚshutilÚrmtree)r   r   r   r   r   r   A   s    r   )Ú
contextlibr   r   r   r   r   r   ÚImportErrorÚcontextmanagerr   r   r   r   r   r   Ú<module>)   s   
