U
    P|jP  ã                   @   sR   d Z ddlZG dd„ deƒZG dd„ deƒZG dd„ deƒZddd„Zdd„ ZdS )zf
A release-automation toolkit.

Don't use this outside of Twisted.

Maintainer: Christopher Armstrong
é    Nc                   @   s   e Zd ZdZdS )ÚDirectoryExistsz2
    Some directory exists when it shouldn't.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú:/tmp/pip-unpacked-wheel-audpp6lv/twisted/python/release.pyr      s   r   c                   @   s   e Zd ZdZdS )ÚDirectoryDoesntExistz6
    Some directory doesn't exist when it should.
    Nr   r   r   r   r	   r
      s   r
   c                   @   s   e Zd ZdS )ÚCommandFailedN)r   r   r   r   r   r   r	   r   "   s   r   TFc                 C   sF   t d| ƒ |r tdƒ d¡r dS |r,d|  } t | ¡dkrBt| ƒ‚dS )z½
    I'll try to execute C{command}, and if C{prompt} is true, I'll
    ask before running it.  If the command returns something other
    than 0, I'll raise C{CommandFailed(command)}.
    z--$zrun ?? ÚnNz%s > /dev/nullr   )ÚprintÚinputÚ
startswithÚosÚsystemr   )ÚcommandÚnullÚpromptr   r   r	   Úsh)   s    
r   c              	   O   s,   t j d¡}z| ||ŽW ¢S t  |¡ X d S )NÚ.)r   ÚpathÚabspathÚchdir)ÚfÚargsÚkwZorigdirr   r   r	   ÚrunChdirSafe:   s    r   )TF)r   r   ÚOSErrorr   r
   r   r   r   r   r   r   r	   Ú<module>   s   	
