From 51194d6fd5e276e61094120033aa3e14f23cbd18 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 5 Mar 2018 03:30:21 +0100 Subject: Simplify sync_deps() value tests Use the result from the initial str_value call in more places. Also add a comment to make it clear how _write_to_conf is calculated, mirroring the ones in write_config() and write_autoconf(). --- kconfiglib.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index 0543c95..afd480e 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1033,6 +1033,9 @@ class Kconfig(object): self._load_old_vals() for sym in self.defined_syms: + # Note: _write_to_conf is determined when the value is + # calculated. This is a hidden function call due to + # property magic. val = sym.str_value # Note: n tristate values do not get written to auto.conf and @@ -1041,12 +1044,12 @@ class Kconfig(object): if sym._write_to_conf: if sym._old_val is None and \ sym.orig_type in (BOOL, TRISTATE) and \ - not sym.tri_value: + val == "n": # No old value (the symbol was missing or n), new value n. # No change. continue - if sym.str_value == sym._old_val: + if val == sym._old_val: # New value matches old. No change. continue -- cgit v1.2.3