diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-18 15:20:13 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-21 23:08:19 +0000 |
commit | 91fdad8c16af9e64aeedb10eb53b1a6cfacd38cd (patch) | |
tree | c327fe6a76aa9f35e0bfd33c69ba13d621274ab3 | |
parent | 41f523e7a996767eec84f3583fd46a1f0f9b8fd7 (diff) | |
download | poky-91fdad8c16af9e64aeedb10eb53b1a6cfacd38cd.tar.gz |
oeqa/devtool: Avoid unbound variable errors
inherits can be unset resulting in:
UnboundLocalError: local variable 'inherits' referenced before assignment
which can mask real errors. Avoid this.
(From OE-Core rev: 29a0502e101ed0667e960f9f8591b0a2d60a4bcb)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 3a25da2033..f4b303bd1c 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -137,6 +137,7 @@ class DevtoolBase(OESelftestTestCase): | |||
137 | with open(recipefile, 'r') as f: | 137 | with open(recipefile, 'r') as f: |
138 | invar = None | 138 | invar = None |
139 | invalue = None | 139 | invalue = None |
140 | inherits = set() | ||
140 | for line in f: | 141 | for line in f: |
141 | var = None | 142 | var = None |
142 | if invar: | 143 | if invar: |
@@ -158,7 +159,7 @@ class DevtoolBase(OESelftestTestCase): | |||
158 | invar = var | 159 | invar = var |
159 | continue | 160 | continue |
160 | elif line.startswith('inherit '): | 161 | elif line.startswith('inherit '): |
161 | inherits = line.split()[1:] | 162 | inherits.update(line.split()[1:]) |
162 | 163 | ||
163 | if var and var in checkvars: | 164 | if var and var in checkvars: |
164 | needvalue = checkvars.pop(var) | 165 | needvalue = checkvars.pop(var) |