Add utility function to check whether an executable is available in the PATH env variable. --- src/virtBootstrap/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py index 84d1629..2bd7873 100644 --- a/src/virtBootstrap/utils.py +++ b/src/virtBootstrap/utils.py @@ -32,6 +32,7 @@ import subprocess import sys import tempfile import logging +from distutils.spawn import find_executable import guestfs import passlib.hosts @@ -646,3 +647,12 @@ def mapping_uid_gid(dest, uid_map, gid_map): balance_uid_gid_maps(uid_map, gid_map) for uid, gid in zip(uid_map, gid_map): map_id(dest, uid, gid) + + +def is_installed(executable): + """ + Try to find executable listed in the PATH env variable. + + Returns the complete filename or None if not found. + """ + return find_executable(executable) -- 2.13.6 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list