From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dan.rpsys.net (5751f4a1.skybroadband.com [87.81.244.161]) by mail.openembedded.org (Postfix) with ESMTP id 3A82A65CAC for ; Fri, 26 Jun 2015 16:23:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t5QGNqks032510 for ; Fri, 26 Jun 2015 17:23:52 +0100 Received: from dan.rpsys.net ([127.0.0.1]) by localhost (dan.rpsys.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id hqkum0R4bvVZ for ; Fri, 26 Jun 2015 17:23:52 +0100 (BST) Received: from [192.168.3.10] ([192.168.3.10]) (authenticated bits=0) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t5QGNcha032500 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 26 Jun 2015 17:23:49 +0100 Message-ID: <1435335817.10583.27.camel@linuxfoundation.org> From: Richard Purdie To: bitbake-devel Date: Fri, 26 Jun 2015 17:23:37 +0100 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Subject: [PATCH] codeparser: Allow empty functions X-BeenThere: bitbake-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussion that advance bitbake development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2015 16:23:58 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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] Signed-off-by: Richard Purdie diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index 2d3574c..82a3af4 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py @@ -245,6 +245,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: