Skip to content

Commit 8fc0de7

Browse files
STABL-SWjserv
authored andcommitted
Move expected value check to after all dependencies got resolved
Moved check to see that the actual value matches the desired one for a symbol to after all symbols were loaded since the dependencies get re-evaluated on each iteration.
1 parent 0faca44 commit 8fc0de7

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

kconfiglib.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,7 @@ def _load_config(self, filename, replace):
12651265
set_match = self._set_match
12661266
unset_match = self._unset_match
12671267
get_sym = self.syms.get
1268+
desired_vals = []
12681269

12691270
for linenr, line in enumerate(f, 1):
12701271
# The C tools ignore trailing whitespace
@@ -1273,6 +1274,7 @@ def _load_config(self, filename, replace):
12731274
match = set_match(line)
12741275
if match:
12751276
name, val = match.groups()
1277+
desired_vals.append((name, val))
12761278
sym = get_sym(name)
12771279
if not sym or not sym.nodes:
12781280
self._undef_assign(name, val, filename, linenr)
@@ -1353,12 +1355,6 @@ def _load_config(self, filename, replace):
13531355

13541356
sym.set_value(val)
13551357

1356-
if val != sym.str_value:
1357-
self._warn("{} was assigned the value '{}', but got the "
1358-
"value '{}'. Check the symbol's dependencies, and make "
1359-
"sure that it has a prompt."
1360-
.format(name, val, sym.str_value))
1361-
13621358
if replace:
13631359
# If we're replacing the configuration, unset the symbols that
13641360
# didn't get set
@@ -1371,6 +1367,15 @@ def _load_config(self, filename, replace):
13711367
if not choice._was_set:
13721368
choice.unset_value()
13731369

1370+
syms_to_be_written = dict(map (lambda s: (s.name, s.str_value), self.unique_defined_syms))
1371+
for (name, val) in desired_vals:
1372+
if name in syms_to_be_written.keys() and (syms_to_be_written[name] != val.strip('"')):
1373+
self._warn("{} was assigned the value '{}', but got the "
1374+
"value '{}'. Check the symbol's dependencies, and make "
1375+
"sure that it has a prompt."
1376+
.format(name, val, syms_to_be_written[name]))
1377+
1378+
13741379
def _undef_assign(self, name, val, filename, linenr):
13751380
# Called for assignments to undefined symbols during .config loading
13761381

0 commit comments

Comments
 (0)