1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-03 17:50:11 +02:00

vmtools: use pythonic way to check for installed binaries

This commit is contained in:
Michael Pöhn 2018-06-19 14:47:03 +02:00
parent ebe71472d3
commit a318a637a5

View File

@ -120,18 +120,9 @@ def get_build_vm(srvdir, provider=None):
logging.warn('build vm provider not supported: \'%s\'', provider)
# try guessing provider from installed software
try:
kvm_installed = 0 == _check_call(['which', 'kvm'])
except subprocess.CalledProcessError:
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
kvm_installed = shutil.which('kvm') is not None
kvm_installed |= shutil.which('qemu') is not None
vbox_installed = shutil.which('VBoxHeadless') is not None
if kvm_installed and vbox_installed:
logging.debug('both kvm and vbox are installed.')
elif kvm_installed: