Find template automatically in script dir
Change-Id: I8ef69ab4ef6f92c55a7393620abe134ac748a93b
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pimgen.py b/pimgen.py
index 2320925..1b10dd9 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -19,6 +19,8 @@
return e
if __name__ == '__main__':
+ script_dir = os.path.dirname(os.path.realpath(__file__))
+
parser = argparse.ArgumentParser(
description='Phosphor Inventory Manager (PIM) YAML '
'scanner and code generator.')
@@ -29,10 +31,6 @@
'-d', '--dir', dest='inputdir',
default='example',
help='Location of files to process.')
- parser.add_argument(
- '-t', '--template', dest='template',
- default='generated.mako.cpp',
- help='Location of mako template.')
args = parser.parse_args()
@@ -47,7 +45,8 @@
for e in yaml.load(fd.read()).get('events', {}):
events.append(parse_event(e))
- t = Template(filename=args.template)
+ template = os.path.join(script_dir, 'generated.mako.cpp')
+ t = Template(filename=template)
with open(os.path.join(args.inputdir, 'interfaces.yaml'), 'r') as fd:
interfaces = yaml.load(fd.read())