Commit f46ebc3c authored by Ulf Magnusson's avatar Ulf Magnusson Committed by Carles Cufi
Browse files

kconfig.py: Use messages returned by load_config() and write_config()



load_config() and write_config() now return a message to print. This
message also says whether the configuration was loaded (replace=True) or
merged (replace=False), and whether the new .config is different from
the old (for write_config()).

Print the returned messages and remove some old print()s.

Also switch to an improved warning control API (the old one is still
supported, but might as well).

Signed-off-by: default avatarUlf Magnusson <Ulf.Magnusson@nordicsemi.no>
parent e36e544c
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -31,18 +31,18 @@ def main():
    print("Parsing Kconfig tree in " + args.kconfig_root)
    kconf = Kconfig(args.kconfig_root, warn_to_stderr=False)

    # Warn for assignments to undefined symbols
    kconf.warn_assign_undef = True

    # prj.conf may override settings from the board configuration, so disable
    # warnings about symbols being assigned more than once
    kconf.disable_override_warnings()
    kconf.disable_redun_warnings()
    # Warn for assignments to undefined symbols
    kconf.enable_undef_warnings()
    kconf.warn_assign_override = False
    kconf.warn_assign_redun = False

    for i, config in enumerate(args.conf_fragments):
        print(("Loading {} as base" if i == 0 else "Merging {}")
              .format(config))
    print(kconf.load_config(args.conf_fragments[0]))
    for config in args.conf_fragments[1:]:
        # replace=False creates a merged configuration
        kconf.load_config(config, replace=False)
        print(kconf.load_config(config, replace=False))

    # Print warnings for symbols whose actual value doesn't match the assigned
    # value
@@ -89,8 +89,7 @@ def main():
                100) + "\n")

    # Write the merged configuration and the C header
    kconf.write_config(args.dotconfig)
    print("Configuration written to '{}'".format(args.dotconfig))
    print(kconf.write_config(args.dotconfig))
    kconf.write_autoconf(args.autoconf)

    # Write the list of processed Kconfig sources to a file