diff options
| -rw-r--r-- | kconfiglib.py | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 3ad52c3..aa2e437 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1316,25 +1316,29 @@ class Kconfig(object): # calculated. This is a hidden function call due to # property magic. val = sym.str_value - if sym._write_to_conf: - if sym.orig_type in _BOOL_TRISTATE: - if val != "n": - f.write("#define {}{}{} 1\n" - .format(self.config_prefix, sym.name, - "_MODULE" if val == "m" else "")) - - elif sym.orig_type is STRING: - f.write('#define {}{} "{}"\n' - .format(self.config_prefix, sym.name, - escape(val))) - - else: # sym.orig_type in _INT_HEX: - if sym.orig_type is HEX and \ - not val.startswith(("0x", "0X")): - val = "0x" + val + if not sym._write_to_conf: + continue - f.write("#define {}{} {}\n" - .format(self.config_prefix, sym.name, val)) + if sym.orig_type in _BOOL_TRISTATE: + if val == "y": + f.write("#define {}{} 1\n".format( + self.config_prefix, sym.name)) + elif val == "m": + f.write("#define {}{}_MODULE 1\n".format( + self.config_prefix, sym.name)) + + elif sym.orig_type is STRING: + f.write('#define {}{} "{}"\n' + .format(self.config_prefix, sym.name, + escape(val))) + + else: # sym.orig_type in _INT_HEX: + if sym.orig_type is HEX and \ + not val.startswith(("0x", "0X")): + val = "0x" + val + + f.write("#define {}{} {}\n" + .format(self.config_prefix, sym.name, val)) def write_config(self, filename=None, header="# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)\n", |
