diff mbox series

[U-Boot,v2,10/31] binman: Allow easy importing of entry modules

Message ID 20190708202553.225715-11-sjg@chromium.org
State Accepted
Commit e430440232e455c0b670a3f5647fbab649e34f4b
Delegated to: Simon Glass
Headers show
Series binman: Allow reading of images to list contents | expand

Commit Message

Simon Glass July 8, 2019, 8:25 p.m. UTC
At present entry modules can only be accessed using Entry.Lookup() or
Entry.Create(). Most of the time this is fine, but sometimes a module
needs to provide constants or helper functions useful to other modules.
It is easier in this case to use 'import'.

Add an __init__ file to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/entry.py          | 2 ++
 tools/binman/etype/__init__.py | 0
 tools/patman/test_util.py      | 1 +
 3 files changed, 3 insertions(+)
 create mode 100644 tools/binman/etype/__init__.py

Comments

Simon Glass July 18, 2019, 1:58 a.m. UTC | #1
At present entry modules can only be accessed using Entry.Lookup() or
Entry.Create(). Most of the time this is fine, but sometimes a module
needs to provide constants or helper functions useful to other modules.
It is easier in this case to use 'import'.

Add an __init__ file to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/entry.py          | 2 ++
 tools/binman/etype/__init__.py | 0
 tools/patman/test_util.py      | 1 +
 3 files changed, 3 insertions(+)
 create mode 100644 tools/binman/etype/__init__.py

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 00bb1d190a9..a04e149d96c 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -513,6 +513,8 @@  features to produce new behaviours.
             modules.remove('_testing')
         missing = []
         for name in modules:
+            if name.startswith('__'):
+                continue
             module = Entry.Lookup(name, name)
             docs = getattr(module, '__doc__')
             if test_missing == name:
diff --git a/tools/binman/etype/__init__.py b/tools/binman/etype/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index 40098159c08..09f258c26b4 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -58,6 +58,7 @@  def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
         test_set = set([os.path.splitext(os.path.basename(line.split()[0]))[0]
                         for line in lines if '/etype/' in line])
         missing_list = required
+        missing_list.discard('__init__')
         missing_list.difference_update(test_set)
         if missing_list:
             print('Missing tests for %s' % (', '.join(missing_list)))