diff options
author | Simon Glass <sjg@chromium.org> | 2020-04-17 18:09:03 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-04-26 14:25:21 -0600 |
commit | 16287933a852bab2ac4985a770e08c9aa69d21b1 (patch) | |
tree | e907492e72c279b64ac971c916de8078a48e8157 /tools/binman/entry.py | |
parent | 0ede00fdaf1d2162350631294f57645675737d89 (diff) | |
download | u-boot-16287933a852bab2ac4985a770e08c9aa69d21b1.zip u-boot-16287933a852bab2ac4985a770e08c9aa69d21b1.tar.gz u-boot-16287933a852bab2ac4985a770e08c9aa69d21b1.tar.bz2 |
binman: Move to absolute imports
At present binman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.
Move binman to use absolute imports. This enables removable of the path
adjusting in Entry also.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r-- | tools/binman/entry.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 1244d36..9f62322 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -9,9 +9,9 @@ import importlib import os import sys -import fdt_util +from dtoc import fdt_util import tools -from tools import ToHex, ToHexSize +from patman.tools import ToHex, ToHexSize import tout modules = {} @@ -63,7 +63,7 @@ class Entry(object): def __init__(self, section, etype, node, name_prefix=''): # Put this here to allow entry-docs and help to work without libfdt global state - import state + from binman import state self.section = section self.etype = etype @@ -108,15 +108,11 @@ class Entry(object): # Import the module if we have not already done so. if not module: - old_path = sys.path - sys.path.insert(0, os.path.join(our_path, 'etype')) try: - module = importlib.import_module(module_name) + module = importlib.import_module('binman.etype.' + module_name) except ImportError as e: raise ValueError("Unknown entry type '%s' in node '%s' (expected etype/%s.py, error '%s'" % (etype, node_path, module_name, e)) - finally: - sys.path = old_path modules[module_name] = module # Look up the expected class name @@ -590,9 +586,7 @@ features to produce new behaviours. modules.remove('_testing') missing = [] for name in modules: - if name.startswith('__'): - continue - module = Entry.Lookup(name, name) + module = Entry.Lookup('WriteDocs', name) docs = getattr(module, '__doc__') if test_missing == name: docs = None |