[oe-commits] [bitbake] 01/02: utils: Avoid warnings about deprecated imp module
git at git.openembedded.org
git at git.openembedded.org
Tue Nov 13 22:58:12 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit c2d834c642b29540908dc32a2c82757c4da09344
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Nov 13 22:45:48 2018 +0000
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
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/utils.py | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 73b6cb4..1cadbc5 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -27,7 +27,7 @@ import bb
import bb.msg
import multiprocessing
import fcntl
-import imp
+import importlib
import itertools
import subprocess
import glob
@@ -43,7 +43,7 @@ from contextlib import contextmanager
from ctypes import cdll
logger = logging.getLogger("BitBake.Util")
-python_extensions = [e for e, _, _ in imp.get_suffixes()]
+python_extensions = importlib.machinery.all_suffixes()
def clean_context():
@@ -1544,12 +1544,9 @@ def export_proxies(d):
def load_plugins(logger, plugins, pluginpath):
def load_plugin(name):
logger.debug(1, 'Loading plugin %s' % name)
- fp, pathname, description = imp.find_module(name, [pluginpath])
- try:
- return imp.load_module(name, fp, pathname, description)
- finally:
- if fp:
- fp.close()
+ spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] )
+ if spec:
+ return spec.loader.load_module()
logger.debug(1, 'Loading plugins from %s...' % pluginpath)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list