Look for interfaces.yaml in --dir
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I08e28c6fdb6073d65e6100fbf20c4ae271d04f4d
diff --git a/pimgen.py b/pimgen.py
index 1e20aa0..2320925 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -27,31 +27,28 @@
default='generated.cpp', help='Output file name.')
parser.add_argument(
'-d', '--dir', dest='inputdir',
- default=os.path.join('example', 'events'),
+ default='example',
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', '--template', dest='template',
default='generated.mako.cpp',
help='Location of mako template.')
args = parser.parse_args()
+ events_dir = os.path.join(args.inputdir, 'events')
yaml_files = filter(
lambda x: x.endswith('.yaml'),
- os.listdir(args.inputdir))
+ os.listdir(events_dir))
events = []
for x in yaml_files:
- with open(os.path.join(args.inputdir, x), 'r') as fd:
+ with open(os.path.join(events_dir, x), 'r') as fd:
for e in yaml.load(fd.read()).get('events', {}):
events.append(parse_event(e))
t = Template(filename=args.template)
- with open(args.interfaces, 'r') as fd:
+ with open(os.path.join(args.inputdir, 'interfaces.yaml'), 'r') as fd:
interfaces = yaml.load(fd.read())
with open(args.output, 'w') as fd: