From dcbbe545bf5dbd34c8e2f934a33e59e5d38843cc Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 26 Jun 2015 17:23:37 +0100 Subject: bitbake: codeparser: Allow empty functions The main parser and other code copes with empty python functions but the python codeparser does not. Fix this to avoid errors with code like: python do_build () { } which currently results in the obtuse: "Failure expanding variable do_build: IndexError: string index out of range" [YOCTO #7829] (Bitbake rev: e4f594c670189e04d58ce7d160fc1d86123620af) Signed-off-by: Richard Purdie --- bitbake/lib/bb/codeparser.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bitbake') diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index 21a36f64ca..269016ee89 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py @@ -240,6 +240,9 @@ class PythonParser(): self.unhandled_message = "while parsing %s, %s" % (name, self.unhandled_message) def parse_python(self, node): + if not node or not node.strip(): + return + h = hash(str(node)) if h in codeparsercache.pythoncache: -- cgit v1.2.3-54-g00ecf