9^ddlmZddlZddlZddlmZmZmZmZm Z m Z GddeZ dS))absolute_importN)LockBase LockFailed NotLocked NotMyLock LockTimeout AlreadyLockedc2eZdZdZddZdZdZdZdZdS) LinkLockFilezLock access to a file using atomic property of link(2). >>> lock = LinkLockFile('somefile') >>> lock = LinkLockFile('somefile', threaded=False) Nc t|jdn%#t$rt d|jzwxYw||n|j}t j}| |dkr||z } tj|j|j dS#t$rtj |jj }|dkrYdS|dt j|krMtj |j|dkrtd|jzt!d|jzt j|dur|dz pd YnwxYw) Nwbzfailed to create %srTz&Timeout waiting to acquire lock for %sz%s is already locked g?)open unique_namecloseIOErrorrtimeouttimeoslink lock_fileOSErrorstatst_nlinkunlinkr pathr sleep)selfrend_timenlinkss /srv/buildsys-work-dir/castor/build_node/builder-1/MVYGK/unpkd_srcs/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/lockfile/linklockfile.pyacquirezLinkLockFile.acquires G !4 ( ( . . 0 0 0 0 G G G2T5EEFF F G%0''dl9;;  7Q;;  H  ($.999,+ L L L!122;Q;;FF*ty{{X/E/E $"2333"Q;;"-/=.2i/8#9#99#00F04 1:#;#;;Jwd2Cw|JsKKKKK% L  s"'*"A <B.EBEEc6|std|jztj|jst d|jztj|jtj|jdS)Nz%s is not lockedz%s is locked, but not by me) is_lockedrrrexistsrrrrr s r#releasezLinkLockFile.release7s~~ G.:;; ; 011 G9DIEFF F $"### $.!!!!!cJtj|jSN)rrr'rr(s r#r&zLinkLockFile.is_locked?sw~~dn---r*c|oEtj|jo!tj|jjdkS)Nr)r&rrr'rrrr(s r# i_am_lockingzLinkLockFile.i_am_lockingBsJ  8t/008())2a7 9r*ctj|jrtj|jdSdSr,)rrr'rrr(s r# break_lockzLinkLockFile.break_lockGs< 7>>$. ) ) & Idn % % % % % & &r*r,) __name__ __module__ __qualname____doc__r$r)r&r.r0r*r#r r so $$$$L"""...999 &&&&&r*r ) __future__rrrrrrrr r r r5r*r#r8s&&&&&& ?&?&?&?&?&8?&?&?&?&?&r*