@V r d dl mZmZ d dlZd dlZd dlZd dlZddlmZm Z m
Z
mZmZm
Z
G d de ZdS ) )absolute_importdivisionN )LockBase
LockFailed NotLocked NotMyLockLockTimeout
AlreadyLockedc : e Zd ZdZd
dZddZd Zd Zd Zd Z dS )
MkdirLockFilez"Lock file by creating a directory.TNc t j | ||| t j | j | j d| j | j | _ dS )zs
>>> lock = MkdirLockFile('somefile')
>>> lock = MkdirLockFile('somefile', threaded=False)
.N)
r __init__ospathjoin lock_filehostnametnamepidunique_name)selfr threadedtimeouts v/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/lockfile/mkdirlockfile.pyr zMkdirLockFile.__init__ s]
$h888 7<<59]]]59ZZ59XX)?@ @ c ||n| j }t j }||dk r||z
}|d}nt d|dz } t j | j t
| j d d S # t $ r t j d }|j t j
k rt j | j rY d S |Kt j |k r4|dk rt! d| j z t# d| j z t j | nt' d | j z Y nw xY w#)
Nr g?
Twbr z&Timeout waiting to acquire lock for %sz%s is already lockedzfailed to create %s)r timemaxr mkdirr openr closeOSErrorsysexc_infoerrnoEEXISTr existsr
r sleepr )r r end_timewaiterrs r acquirezMkdirLockFile.acquire s $0''dl9;;7Q;;H?DDq'B,''D
(((, T%t,,22444-
M
M
MlnnQ'9,,w~~d&677 *ty{{X/E/E"Q;;"- /=.2i/8 #9 #9 9
#00F04 1: #; #; ;Jt$$$$ %%:T^%KLLL %$!
M s B AE#'A9E#"E#c 6 | st d| j z t j | j st
d| j z t j | j t j | j d S )Nz%s is not lockedz%s is locked, but not by me)
is_lockedr r r r+ r r unlinkrmdirr r s r releasezMkdirLockFile.releaseA s ~~ G.:;;; 011 G9DIEFFF
$"###
r c J t j | j S N)r r r+ r r5 s r r2 zMkdirLockFile.is_lockedI s w~~dn---r c r | o#t j | j S r8 )r2 r r r+ r r5 s r i_am_lockingzMkdirLockFile.i_am_lockingL s- 1t/00 2r c * t j | j rnt j | j D ]9}t j t j | j | :t j | j d S d S r8 )r r r+ r listdirr3 r r4 )r names r
break_lockzMkdirLockFile.break_lockP s|
7>>$.)) %
4>22
>
> "',,t~t<<====HT^$$$$$ % %r )TNr8 )
__name__
__module____qualname____doc__r r0 r6 r2 r: r> r r r
r
s ,,@ @ @ @$ $ $ $L! ! !. . .2 2 2% % % % %r r
)
__future__r r r! r r' r) r r r r r
r r
rC r r