summaryrefslogtreecommitdiffstats
path: root/errors_map_gen.py
diff options
context:
space:
mode:
Diffstat (limited to 'errors_map_gen.py')
-rwxr-xr-xerrors_map_gen.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/errors_map_gen.py b/errors_map_gen.py
new file mode 100755
index 0000000..6e60610
--- /dev/null
+++ b/errors_map_gen.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import os
+import yaml
+from mako.template import Template
+import argparse
+
+def main():
+ parser = argparse.ArgumentParser(
+ description="OpenPOWER error map code generator")
+
+ parser.add_argument(
+ '-i', '--errors_map_yaml', dest='errors_map_yaml',
+ default='errors_watch.yaml', help='input errors watch yaml file to parse')
+ args = parser.parse_args()
+
+ with open(os.path.join(script_dir, args.errors_map_yaml), 'r') as fd:
+ yamlDict = yaml.safe_load(fd)
+
+ # Render the mako template
+ template = os.path.join(script_dir, 'errors_map.mako.hpp')
+ t = Template(filename=template)
+ with open('errors_map.hpp', 'w') as fd:
+ fd.write(
+ t.render(
+ errDict=yamlDict))
+
+
+if __name__ == '__main__':
+ script_dir = os.path.dirname(os.path.realpath(__file__))
+ main() \ No newline at end of file
OpenPOWER on IntegriCloud