From 8964d2aaf758962704214fb4325b45c0c11134fa Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 8 Sep 2017 00:50:23 +0200 Subject: Fix handling of tag and multi nodes in the convertor. Ugly fixup in the makefile to delete generated node.def's that are now in other packages. Adjust the cron interface definition to better match the old templates. --- scripts/build-command-templates | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/build-command-templates b/scripts/build-command-templates index 3c95bde21..17442bfcb 100755 --- a/scripts/build-command-templates +++ b/scripts/build-command-templates @@ -70,7 +70,7 @@ def make_path(l): return(functools.reduce(os.path.join, l)) def get_properties(p): - props = {"tag": False, "type": "txt"} + props = {} if p is None: return props @@ -97,6 +97,10 @@ def get_properties(p): except: pass + # Get "multi" + if p.find("multi") is not None: + props["multi"] = True + return props def make_node_def(props): @@ -108,7 +112,11 @@ def make_node_def(props): if "tag" in props: node_def += "tag:\n" - node_def += "type: {0}\n".format(props["type"]) + if "type" in props: + node_def += "type: {0}\n".format(props["type"]) + + if "multi" in props: + node_def += "multi:\n" if "priority" in props: node_def += "priority: {0}\n".format(props["priority"]) @@ -135,6 +143,7 @@ def process_node(n, tmpl_dir): name = n.get("name") owner = n.get("owner") + node_type = n.tag my_tmpl_dir.append(name) os.makedirs(make_path(my_tmpl_dir), exist_ok=True) @@ -142,13 +151,17 @@ def process_node(n, tmpl_dir): props = get_properties(props_elem) if owner: props["owner"] = owner + # Type should not be set for non-tag, non-leaf nodes + if node_type != "node": + props["type"] = "txt" + if node_type == "tagNode": + props["tag"] = "True" with open(os.path.join(make_path(my_tmpl_dir), "node.def"), "w") as f: f.write(make_node_def(props)) - node_type = n.tag if node_type == "node": inner_nodes = children.iterfind("*") for inner_n in inner_nodes: -- cgit v1.2.3