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