[OE-core] [PATCH 1/2] oeqa/devtool: Avoid unbound variable errors
Richard Purdie
richard.purdie at linuxfoundation.org
Mon Nov 18 15:47:49 UTC 2019
inherits can be unset resulting in:
UnboundLocalError: local variable 'inherits' referenced before assignment
which can mask real errors. Avoid this.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/lib/oeqa/selftest/cases/devtool.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 3a25da2033b..f4b303bd1c7 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -137,6 +137,7 @@ class DevtoolBase(OESelftestTestCase):
with open(recipefile, 'r') as f:
invar = None
invalue = None
+ inherits = set()
for line in f:
var = None
if invar:
@@ -158,7 +159,7 @@ class DevtoolBase(OESelftestTestCase):
invar = var
continue
elif line.startswith('inherit '):
- inherits = line.split()[1:]
+ inherits.update(line.split()[1:])
if var and var in checkvars:
needvalue = checkvars.pop(var)
--
2.20.1
More information about the Openembedded-core
mailing list