createvm: Replace deprecated pkgutil.find_loader

importlib.util.find_spec is around since python 3.4

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-03-03 10:23:33 -05:00
parent 0c899a7ccd
commit a52ab24ec4

View File

@ -4,8 +4,8 @@
# This work is licensed under the GNU GPLv2 or later. # This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory. # See the COPYING file in the top-level directory.
import importlib
import io import io
import pkgutil
import os import os
import threading import threading
import time import time
@ -79,7 +79,7 @@ def _pretty_memory(mem):
########################################################### ###########################################################
def is_virt_bootstrap_installed(conn): def is_virt_bootstrap_installed(conn):
ret = pkgutil.find_loader('virtBootstrap') is not None ret = importlib.util.find_spec('virtBootstrap') is not None
return ret or conn.config.CLITestOptions.fake_virtbootstrap return ret or conn.config.CLITestOptions.fake_virtbootstrap