summaryrefslogtreecommitdiff
path: root/esds
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-09-11 08:17:46 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-09-11 08:17:46 +0200
commit75c2ce0991dabccfaad5b6f1d72175566ce75467 (patch)
treebf50c54fac012bc7da0bfa6f53a2d18585aff7f0 /esds
parentbe1966b40fba00e374433d4b7d93598b0ca35223 (diff)
Improve platform parsing
Diffstat (limited to 'esds')
-rw-r--r--esds/helpers/platform.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/esds/helpers/platform.py b/esds/helpers/platform.py
index 7d16756..7112ebc 100644
--- a/esds/helpers/platform.py
+++ b/esds/helpers/platform.py
@@ -47,6 +47,8 @@ class YAMLPlatformFile:
self.default={
"breakpoints": [],
"breakpoints_every": None,
+ "breakpoints_file": None,
+ "breakpoints_callback": None,
"debug": False,
"interferences": True,
"node_count": 0,
@@ -71,7 +73,9 @@ class YAMLPlatformFile:
else:
self.parsing_error("platform file has no interfaces section")
- print(self.default)
+ ##### Sanity checks
+ if None in self.default["implementations"]:
+ self.parsing_error("Some nodes do not have assigned implementation")
def parsing_error(self,msg):
raise Exception("Fail to parse platform file \""+self.file_path+"\": "+msg)
@@ -162,6 +166,17 @@ class YAMLPlatformFile:
if not str(general["breakpoints_every"]).isnumeric():
self.parsing_error("breakpoints_every should be a number")
self.default["breakpoints_every"]=general["breakpoints_every"]
+ if "breakpoints_callback" in general:
+ cb=general["breakpoints_callback"]
+ file=cb["file"]
+ path, ext=os.path.splitext(file)
+ if not os.path.exists(file):
+ self.parsing_error("File "+file+ " not found")
+ path, extension = os.path.splitext(file)
+ if extension != ".py":
+ self.parsing_error("File "+file+" must be a python file")
+ self.default["breakpoints_file"]=cb["file"]
+ self.default["breakpoints_callback"]=cb["callback"]
if "debug" in general:
if type(general["debug"]) != bool:
self.parsing_error("debug should be on or off")