From be2a885d424349ebf51fd516b71c5b01722ed3d1 Mon Sep 17 00:00:00 2001 From: "Peter A. Bigot" Date: Thu, 12 Sep 2019 14:08:29 -0500 Subject: [PATCH] scripts/dts/gen_defines.py: exclude initializer lists from conf file Things that parse generated_dts_board.conf can't deal with entries like: DT_GPIO_KEYS_BUTTON_1_GPIOS={"GPIO_0", 14, 256} so keep them from being added there. Signed-off-by: Peter A. Bigot --- scripts/dts/gen_defines.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index 072890797fe..0571c686ef8 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -653,15 +653,23 @@ def out(ident, val, aliases=()): print("#define DT_{:40} {}".format(ident, val), file=header_file) primary_ident = "DT_{}".format(ident) - print("{}={}".format(primary_ident, val), file=conf_file) + + # Exclude things that aren't single token values from .conf. At + # the moment the only such items are unquoted string + # representations of initializer lists, which begin with a curly + # brace. + output_to_conf = not (isinstance(val, str) and val.startswith("{")) + if output_to_conf: + print("{}={}".format(primary_ident, val), file=conf_file) for alias in aliases: if alias != ident: print("#define DT_{:40} DT_{}".format(alias, ident), file=header_file) - # For the configuration file, the value is just repeated for all - # the aliases - print("DT_{}={}".format(alias, val), file=conf_file) + if output_to_conf: + # For the configuration file, the value is just repeated for all + # the aliases + print("DT_{}={}".format(alias, val), file=conf_file) return primary_ident