pimgen: Pass interfaces.yaml to Mako template
Update pimgen.py to pass interfaces.yaml to the Mako
template in prep for generating the interface -> binding
factory method associations.
Change-Id: Ic053628331ef0e5a1ef4a8a9d50ff6f4e662cf08
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pimgen.py b/pimgen.py
index 7c32594..306cc49 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -30,6 +30,10 @@
default=os.path.join('example', 'events'),
help='Location of files to process.')
parser.add_argument(
+ '-i', '--interfaces', dest='interfaces',
+ default=os.path.join('example', 'interfaces.yaml'),
+ help='Location of interface file.'),
+ parser.add_argument(
'-t', '--templatedir', dest='template',
default='generated.mako.cpp',
help='Location of mako template.')
@@ -47,9 +51,13 @@
events.append(parse_event(e))
t = Template(filename=args.template)
+ with open(args.interfaces, 'r') as fd:
+ interfaces = yaml.load(fd.read())
+
with open(args.output, 'w') as fd:
fd.write(
t.render(
+ interfaces=interfaces,
events=events))