Use fasteners instead of pylockfile
This commit is contained in:
parent
a91757d267
commit
5e4d2103a4
1 changed files with 4 additions and 9 deletions
13
akshara
13
akshara
|
@ -24,10 +24,9 @@ import yaml
|
|||
import shutil
|
||||
import argparse
|
||||
import platform
|
||||
import fasteners
|
||||
import subprocess
|
||||
|
||||
from lockfile import LockFile
|
||||
|
||||
__version = '1.0.0'
|
||||
|
||||
with open('/etc/blend_release') as blend_release_file:
|
||||
|
@ -383,13 +382,9 @@ try:
|
|||
parser.parse_args(['--version'])
|
||||
elif command == handle_system_packages:
|
||||
exec('touch', '/var/lib/.akshara-system-lock')
|
||||
system_lock = LockFile('/var/lib/.akshara-system-lock')
|
||||
if not system_lock.is_locked():
|
||||
system_lock.acquire()
|
||||
else:
|
||||
error('system operation already in progress')
|
||||
exit(1)
|
||||
command(args.command)
|
||||
system_lock = fasteners.InterProcessLock('/var/lib/.akshara-system-lock')
|
||||
with system_lock:
|
||||
command(args.command)
|
||||
else:
|
||||
command()
|
||||
except KeyboardInterrupt:
|
||||
|
|
Loading…
Reference in a new issue