File: //lib/python2.7/site-packages/rhn/rhnLockfile.pyo
�
�+Xc @ s� d d l Z d d l Z d d l Z d d l m Z m Z d d l m Z d d l Z d e f d � � YZ d d d � � YZ
d � Z e d k r� e j
e � p� d
� n d S( i����N( t EWOULDBLOCKt EEXIST( t bstrt LockfileLockedExceptionc B s e Z d Z RS( s$ thrown ONLY when pid file is locked.( t __name__t
__module__t __doc__( ( ( s3 /usr/lib/python2.7/site-packages/rhn/rhnLockfile.pyR s t Lockfilec B s, e Z d Z d d � Z d � Z d � Z RS( s� class that provides simple access to a PID-style lockfile.
methods: __init__(lockfile), acquire(), and release()
NOTE: currently acquires upon init
The *.pid file will be acquired, or an LockfileLockedException is raised.
c C s t j j t j j t j j | � � � | _ | | _ | j sQ t j � | _ n t j j | j � } t j j | � s� y t j
| � Wq� t k
r� t j
� d } t | d � r� | j t k r� q� � q� Xn t j | j t j t j Bt j B� | _ | j � d S( sl create (if need be), and acquire lock on lockfile
lockfile example: '/var/run/up2date.pid'
i t errnoN( t ost patht abspatht
expandusert
expandvarst lockfilet pidt getpidt dirnamet existst makedirst OSErrort syst exc_infot hasattrR R t opent O_RDWRt O_CREATt O_SYNCt ft acquire( t selfR R R t e( ( s3 /usr/lib/python2.7/site-packages/rhn/rhnLockfile.pyt __init__$ s"