kconfig.py: Convert to use f-strings
Use f-strings instead of .format() to make things more readable. They were added in Python 3.6, which Zephyr requires now. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
parent
1a5368a07b
commit
a5f6233428
1 changed files with 12 additions and 15 deletions
|
@ -90,10 +90,10 @@ def main():
|
||||||
# now as well.
|
# now as well.
|
||||||
for warning in kconf.warnings:
|
for warning in kconf.warnings:
|
||||||
if fatal(warning):
|
if fatal(warning):
|
||||||
err("""\
|
err(f"""\
|
||||||
Aborting due to non-whitelisted Kconfig warning '{}'. If this warning doesn't
|
Aborting due to non-whitelisted Kconfig warning '{warning}'. If this warning
|
||||||
point to an actual problem, you can add it to the whitelist at the top of {}.\
|
doesn't point to an actual problem, you can add it to the whitelist at the top
|
||||||
""".format(warning, sys.argv[0]))
|
of {sys.argv[0]}.""")
|
||||||
|
|
||||||
# Write the merged configuration and the C header
|
# Write the merged configuration and the C header
|
||||||
print(kconf.write_config(args.config_out))
|
print(kconf.write_config(args.config_out))
|
||||||
|
@ -108,11 +108,10 @@ def check_no_promptless_assign(kconf):
|
||||||
|
|
||||||
for sym in kconf.unique_defined_syms:
|
for sym in kconf.unique_defined_syms:
|
||||||
if sym.user_value is not None and promptless(sym):
|
if sym.user_value is not None and promptless(sym):
|
||||||
err(("""\
|
err(f"""\
|
||||||
{0.name_and_loc} is assigned in a configuration file, but is not
|
{sym.name_and_loc} is assigned in a configuration file, but is not directly
|
||||||
directly user-configurable (has no prompt). It gets its value indirectly from
|
user-configurable (has no prompt). It gets its value indirectly from other
|
||||||
other symbols. \
|
symbols. """ + SYM_INFO_HINT.format(sym))
|
||||||
""" + SYM_INFO_HINT).format(sym))
|
|
||||||
|
|
||||||
|
|
||||||
def check_assigned_sym_values(kconf):
|
def check_assigned_sym_values(kconf):
|
||||||
|
@ -198,12 +197,10 @@ def check_assigned_choice_values(kconf):
|
||||||
if choice.user_selection and \
|
if choice.user_selection and \
|
||||||
choice.user_selection is not choice.selection:
|
choice.user_selection is not choice.selection:
|
||||||
|
|
||||||
warn(("""\
|
warn(f"""\
|
||||||
the choice symbol {0.name_and_loc} was selected (set =y), but {1} ended up as
|
the choice symbol {choice.user_selection.name_and_loc} was selected (set =y),
|
||||||
the choice selection. \
|
but {choice.selection.name_and_loc if choice.selection else "no symbol"} ended
|
||||||
""" + SYM_INFO_HINT).format(
|
up as the choice selection. """ + SYM_INFO_HINT.format(choice.user_selection))
|
||||||
choice.user_selection,
|
|
||||||
choice.selection.name_and_loc if choice.selection else "no symbol"))
|
|
||||||
|
|
||||||
|
|
||||||
# Hint on where to find symbol information. Used like
|
# Hint on where to find symbol information. Used like
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue