mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 15:02:51 +03:00
vmtools: use pythonic way to check for installed binaries
This commit is contained in:
parent
ebe71472d3
commit
a318a637a5
1 changed files with 3 additions and 12 deletions
|
@ -120,18 +120,9 @@ def get_build_vm(srvdir, provider=None):
|
||||||
logging.warn('build vm provider not supported: \'%s\'', provider)
|
logging.warn('build vm provider not supported: \'%s\'', provider)
|
||||||
|
|
||||||
# try guessing provider from installed software
|
# try guessing provider from installed software
|
||||||
try:
|
kvm_installed = shutil.which('kvm') is not None
|
||||||
kvm_installed = 0 == _check_call(['which', 'kvm'])
|
kvm_installed |= shutil.which('qemu') is not None
|
||||||
except subprocess.CalledProcessError:
|
vbox_installed = shutil.which('VBoxHeadless') is not None
|
||||||
kvm_installed = False
|
|
||||||
try:
|
|
||||||
kvm_installed |= 0 == _check_call(['which', 'qemu'])
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
vbox_installed = 0 == _check_call(['which', 'VBoxHeadless'])
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
vbox_installed = False
|
|
||||||
if kvm_installed and vbox_installed:
|
if kvm_installed and vbox_installed:
|
||||||
logging.debug('both kvm and vbox are installed.')
|
logging.debug('both kvm and vbox are installed.')
|
||||||
elif kvm_installed:
|
elif kvm_installed:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue