Use fasteners instead of pylockfile

This commit is contained in:
Rudra Saraswat 2023-05-09 12:06:00 +05:30
parent a91757d267
commit 5e4d2103a4

11
akshara
View file

@ -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,12 +382,8 @@ 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)
system_lock = fasteners.InterProcessLock('/var/lib/.akshara-system-lock')
with system_lock:
command(args.command)
else:
command()