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. --- Makefile | 3 +++ interface-definitions/cron.xml | 7 +++++-- scripts/build-command-templates | 19 ++++++++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2c7b28c56..3da3a369f 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ TMPL_DIR := templates interface_definitions: find $(CURDIR)/interface-definitions/ -type f | xargs -I {} $(CURDIR)/scripts/build-command-templates {} $(CURDIR)/schema/interface_definition.rng $(TMPL_DIR) + # XXX: delete top level node.def's that now live in other packages + rm $(TMPL_DIR)/system/node.def + .PHONY: all all: interface_definitions diff --git a/interface-definitions/cron.xml b/interface-definitions/cron.xml index 1982ac87c..8ea291a2e 100644 --- a/interface-definitions/cron.xml +++ b/interface-definitions/cron.xml @@ -3,11 +3,14 @@ - + + + Task scheduler settings + - + Scheduled task 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