From f99f34b14b7c48360452a0bcca395e0fc7a01b2b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 19 Jul 2023 17:48:20 -0600 Subject: [PATCH] buildman: Refactor target handling in Boards.scan() Move the assert to the top of the function and provide an explicit variables for the target name and base name. Signed-off-by: Simon Glass --- tools/buildman/boards.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 122fe7090b..2d39326300 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -231,6 +231,10 @@ class KconfigScanner: 'config': , } """ + leaf = os.path.basename(defconfig) + expect_target, match, rear = leaf.partition('_defconfig') + assert match and not rear, f'{leaf} : invalid defconfig' + self._conf.load_config(defconfig) self._tmpfile = None @@ -245,9 +249,7 @@ class KconfigScanner: else: params[key] = '-' - defconfig = os.path.basename(defconfig) - params['target'], match, rear = defconfig.partition('_defconfig') - assert match and not rear, f'{defconfig} : invalid defconfig' + params['target'] = expect_target # fix-up for aarch64 if params['arch'] == 'arm' and params['cpu'] == 'armv8':