summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-13 22:45:48 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-14 11:18:18 +0000
commit54bbe35eab3e8f3618024ca8d1b30ff1c425201f (patch)
treeb5eeafef471abdc74bde074bbf45178744f7a8db /bitbake/lib/bb/utils.py
parent57e290371b00f6b695c6f3220f9860f0a16cd0c9 (diff)
downloadpoky-54bbe35eab3e8f3618024ca8d1b30ff1c425201f.tar.gz
bitbake: utils: Avoid warnings about deprecated imp module
The imp module is deprecated, port the code over to use importlib. bitbake/lib/bb/utils.py:30: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp (Bitbake rev: 3c2cb35588e91fbd7b136e5e2c78eeb77e126c84) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 73b6cb423b..461122bba1 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -27,7 +27,8 @@ import bb
27import bb.msg 27import bb.msg
28import multiprocessing 28import multiprocessing
29import fcntl 29import fcntl
30import imp 30import importlib
31from importlib import machinery
31import itertools 32import itertools
32import subprocess 33import subprocess
33import glob 34import glob
@@ -43,7 +44,7 @@ from contextlib import contextmanager
43from ctypes import cdll 44from ctypes import cdll
44 45
45logger = logging.getLogger("BitBake.Util") 46logger = logging.getLogger("BitBake.Util")
46python_extensions = [e for e, _, _ in imp.get_suffixes()] 47python_extensions = importlib.machinery.all_suffixes()
47 48
48 49
49def clean_context(): 50def clean_context():
@@ -1544,12 +1545,9 @@ def export_proxies(d):
1544def load_plugins(logger, plugins, pluginpath): 1545def load_plugins(logger, plugins, pluginpath):
1545 def load_plugin(name): 1546 def load_plugin(name):
1546 logger.debug(1, 'Loading plugin %s' % name) 1547 logger.debug(1, 'Loading plugin %s' % name)
1547 fp, pathname, description = imp.find_module(name, [pluginpath]) 1548 spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] )
1548 try: 1549 if spec:
1549 return imp.load_module(name, fp, pathname, description) 1550 return spec.loader.load_module()
1550 finally:
1551 if fp:
1552 fp.close()
1553 1551
1554 logger.debug(1, 'Loading plugins from %s...' % pluginpath) 1552 logger.debug(1, 'Loading plugins from %s...' % pluginpath)
1555 1553