[OE-core] [bitbake][PATCH] lib/bb/build.py: Raise proper KeyError if function does not exist
Mike Looijmans
mike.looijmans at topic.nl
Wed Feb 8 06:17:53 UTC 2017
If one adds the following line to an image recipe without defining
the function:
ROOTFS_POSTPROCESS_COMMAND += "rootfs_funky_stuff;"
bitbake will terminate with a cryptic error message:
AttributeError: 'NoneType' object has no attribute 'get'
To inform the user of what bitbake wasn't able to find, raise a KeyError
exception denoting the function name before that happens. This changes the
message to the much more useful:
KeyError: 'rootfs_funky_stuff'
Signed-off-by: Mike Looijmans <mike.looijmans at topic.nl>
---
lib/bb/build.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/bb/build.py b/lib/bb/build.py
index c4c8aeb..5bc18c1 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -194,6 +194,8 @@ def exec_func(func, d, dirs = None, pythonexception=False):
oldcwd = None
flags = d.getVarFlags(func)
+ if flags is None:
+ raise KeyError(func)
cleandirs = flags.get('cleandirs')
if cleandirs:
for cdir in d.expand(cleandirs).split():
--
1.9.1
More information about the Openembedded-core
mailing list