From patchwork Fri Dec 17 02:59:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 1650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1320DC433F5 for ; Fri, 17 Dec 2021 02:59:22 +0000 (UTC) Received: from codeconstruct.com.au (codeconstruct.com.au [203.29.241.158]) by mx.groups.io with SMTP id smtpd.web12.1740.1639709960762514921 for ; Thu, 16 Dec 2021 18:59:21 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: codeconstruct.com.au, ip: 203.29.241.158, mailfrom: jk@codeconstruct.com.au) Received: by codeconstruct.com.au (Postfix, from userid 10000) id 394F42022C; Fri, 17 Dec 2021 10:59:18 +0800 (AWST) From: Jeremy Kerr To: openembedded-devel@lists.openembedded.org Subject: [PATCH 1/2] contrib: allow override-style syntax for vars & routines Date: Fri, 17 Dec 2021 10:59:10 +0800 Message-Id: <23442f7ad508ed66ef43adff0c32a45b07d6fc6f.1639709734.git.jk@codeconstruct.com.au> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 17 Dec 2021 02:59:22 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/94421 Currently, the variable and routine regexes don't support the override-style syntax. This means we may break routine blocks, as we don't recognise overridden routines with an :append/:prepend/etc. This change adds the ":" char to the var & routine regexes. Signed-off-by: Jeremy Kerr --- contrib/oe-stylize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/oe-stylize.py b/contrib/oe-stylize.py index e1ba1b321..67c06b1bb 100755 --- a/contrib/oe-stylize.py +++ b/contrib/oe-stylize.py @@ -210,8 +210,8 @@ OE_vars = [ 'others' ] -varRegexp = r'^([a-zA-Z_0-9${}-]*)([ \t]*)([+.:]?=[+.]?)([ \t]*)([^\t]+)' -routineRegexp = r'^([a-zA-Z0-9_ ${}-]+?)\(' +varRegexp = r'^([a-zA-Z_0-9${}:-]*)([ \t]*)([+.:]?=[+.]?)([ \t]*)([^\t]+)' +routineRegexp = r'^([a-zA-Z0-9_ ${}:-]+?)\(' # Variables seen in the processed .bb seen_vars = {} From patchwork Fri Dec 17 02:59:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 1649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14752C433FE for ; Fri, 17 Dec 2021 02:59:22 +0000 (UTC) Received: from codeconstruct.com.au (codeconstruct.com.au [203.29.241.158]) by mx.groups.io with SMTP id smtpd.web09.1790.1639709960764914507 for ; Thu, 16 Dec 2021 18:59:21 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: codeconstruct.com.au, ip: 203.29.241.158, mailfrom: jk@codeconstruct.com.au) Received: by codeconstruct.com.au (Postfix, from userid 10000) id 7E8C02027B; Fri, 17 Dec 2021 10:59:18 +0800 (AWST) From: Jeremy Kerr To: openembedded-devel@lists.openembedded.org Subject: [PATCH 2/2] contrib: fix python warnings for oe-stylize Date: Fri, 17 Dec 2021 10:59:11 +0800 Message-Id: <6b4456a84e51492f0df94a9c0816c984f333ada0.1639709734.git.jk@codeconstruct.com.au> X-Mailer: git-send-email 2.33.0 In-Reply-To: <23442f7ad508ed66ef43adff0c32a45b07d6fc6f.1639709734.git.jk@codeconstruct.com.au> References: <23442f7ad508ed66ef43adff0c32a45b07d6fc6f.1639709734.git.jk@codeconstruct.com.au> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 17 Dec 2021 02:59:22 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/94422 I get a couple of python SyntaxWarnings when running oe-stylize: [jk@pecola meta-openembedded]$ python3 contrib/oe-stylize.py contrib/oe-stylize.py:372: SyntaxWarning: "is not" with a literal. Did you mean "!="? if line is not '': contrib/oe-stylize.py:389: SyntaxWarning: "is" with a literal. Did you mean "=="? if line.isspace() or line is '': The 'is' operator is for object reference comparison, which is not what we want here. Change to '==' / '!=' instead. Signed-off-by: Jeremy Kerr --- contrib/oe-stylize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/oe-stylize.py b/contrib/oe-stylize.py index 67c06b1bb..30b460e12 100755 --- a/contrib/oe-stylize.py +++ b/contrib/oe-stylize.py @@ -369,7 +369,7 @@ if __name__ == "__main__": line = line.expandtabs().rstrip() # ignore empty lines (or line filled with spaces or tabs only) # so that rule6 is always respected - if line is not '': + if line != '': lines.append(line) # -- parse the file -- @@ -386,7 +386,7 @@ if __name__ == "__main__": line = follow_rule(6, line) # ignore empty lines - if line.isspace() or line is '': + if line.isspace() or line == '': # flush comments into the olines for c in commentBloc: olines.append(c)