summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@baylibre.com>2018-12-19 09:18:37 -0800
committerKevin Hilman <khilman@baylibre.com>2018-12-19 09:23:58 -0800
commit8cb9b1ddbadc1f98afcaf6a33aa8a7e7fd4d34be (patch)
tree950ebd7143d369bd57fcff8bf056d999e3b59184
parent01409708b92a2acb2f8ff1da8d27054530c078f9 (diff)
lavalab-gen: more flexible custom_options
Adding custom options for LAVA often requires specific formatting for the LAVA jinja2 files, including single or double quotes. Rather than also using quotes in the boards.yaml file, use YAML "plain style"[1] avoids the need to add extra quotes or escapes. When using the "|-" for plain style, the custom_options will appear to lavalab-gen as a one long string, rather than a list of options, so here we modify lavalab-gen to handle strings slightly differently than a list. [1] https://yaml.org/spec/1.2/spec.html#id2788859 Signed-off-by: Kevin Hilman <khilman@baylibre.com>
-rwxr-xr-xlavalab-gen.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 1d91f23..312dfd1 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -533,8 +533,12 @@ def main():
deviceinfo.write("DEVICE_GROUP=%s\n" % board["group"])
deviceinfo.close()
if "custom_option" in board:
- for coption in board["custom_option"]:
- device_line += "{%% %s %%}\n" % coption
+ if type(board["custom_option"]) == list:
+ for coption in board["custom_option"]:
+ device_line += "{%% %s %%}\n" % coption
+ else:
+ for line in board["custom_option"].splitlines():
+ device_line += "{%% %s %%}\n" % line
if not os.path.isdir(device_path):
os.mkdir(device_path)
if not os.path.isdir(devices_path):