callouts: add argument for output file
Some build systems prefer output files being in an out-of-tree
location rather than the pwd. Add an optional output file
parameter so that the full path to a desired output can be given.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idf412c9b1a651d20907972af49a525707889568c
diff --git a/callouts/callouts.py b/callouts/callouts.py
index 7ec367b..18aa610 100755
--- a/callouts/callouts.py
+++ b/callouts/callouts.py
@@ -14,6 +14,11 @@
'-i', '--callouts_yaml', dest='callouts_yaml',
default=os.path.join(script_dir, 'callouts-example.yaml'),
help='input callouts yaml')
+ parser.add_argument(
+ '-o', '--output', dest='output',
+ default='callouts-gen.hpp',
+ help='output file name (default: callouts-gen.hpp)')
+
args = parser.parse_args()
with open(args.callouts_yaml, 'r') as fd:
@@ -22,7 +27,7 @@
# Render the mako template
template = os.path.join(script_dir, 'callouts-gen.mako.hpp')
t = Template(filename=template)
- with open('callouts-gen.hpp', 'w') as fd:
+ with open(args.output, 'w') as fd:
fd.write(
t.render(
calloutsMap=calloutsMap))