diff options
Diffstat (limited to 'scripts/lib/scriptutils.py')
-rw-r--r-- | scripts/lib/scriptutils.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index f92255d8dc..47a08194d0 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py | |||
@@ -18,7 +18,8 @@ import sys | |||
18 | import tempfile | 18 | import tempfile |
19 | import threading | 19 | import threading |
20 | import importlib | 20 | import importlib |
21 | from importlib import machinery | 21 | import importlib.machinery |
22 | import importlib.util | ||
22 | 23 | ||
23 | class KeepAliveStreamHandler(logging.StreamHandler): | 24 | class KeepAliveStreamHandler(logging.StreamHandler): |
24 | def __init__(self, keepalive=True, **kwargs): | 25 | def __init__(self, keepalive=True, **kwargs): |
@@ -82,7 +83,9 @@ def load_plugins(logger, plugins, pluginpath): | |||
82 | logger.debug('Loading plugin %s' % name) | 83 | logger.debug('Loading plugin %s' % name) |
83 | spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) | 84 | spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) |
84 | if spec: | 85 | if spec: |
85 | return spec.loader.load_module() | 86 | mod = importlib.util.module_from_spec(spec) |
87 | spec.loader.exec_module(mod) | ||
88 | return mod | ||
86 | 89 | ||
87 | def plugin_name(filename): | 90 | def plugin_name(filename): |
88 | return os.path.splitext(os.path.basename(filename))[0] | 91 | return os.path.splitext(os.path.basename(filename))[0] |
@@ -215,7 +218,8 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr | |||
215 | pathvars = ['T', 'RECIPE_SYSROOT', 'RECIPE_SYSROOT_NATIVE'] | 218 | pathvars = ['T', 'RECIPE_SYSROOT', 'RECIPE_SYSROOT_NATIVE'] |
216 | for pathvar in pathvars: | 219 | for pathvar in pathvars: |
217 | path = rd.getVar(pathvar) | 220 | path = rd.getVar(pathvar) |
218 | shutil.rmtree(path) | 221 | if os.path.exists(path): |
222 | shutil.rmtree(path) | ||
219 | finally: | 223 | finally: |
220 | if fetchrecipe: | 224 | if fetchrecipe: |
221 | try: | 225 | try: |