summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2016-11-12 12:10:07 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2016-11-21 11:28:26 -0500
commit0a6a479efcc28214cced27e9104bed26b937a2aa (patch)
treee38e88c27fa5b728a4e3d3a26584e1e33aabe717
parentea6d93a724ab497ae59e4ea0ea56c33700ed4e4c (diff)
downloadphosphor-inventory-manager-0a6a479efcc28214cced27e9104bed26b937a2aa.tar.gz
phosphor-inventory-manager-0a6a479efcc28214cced27e9104bed26b937a2aa.zip
pimgen: Enable multiple interface files
Allow more than one interface file and put declared interface yaml files in interfaces.d, to draw attention to the intent is for packages to install their interface requirements there. Change-Id: Iab0d85eca7c5c3370978dc692d6ab8807108a2f7 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--example/interfaces.d/example.yaml (renamed from example/interfaces.yaml)2
-rwxr-xr-xpimgen.py18
2 files changed, 16 insertions, 4 deletions
diff --git a/example/interfaces.yaml b/example/interfaces.d/example.yaml
index d48bdef..d5d3329 100644
--- a/example/interfaces.yaml
+++ b/example/interfaces.d/example.yaml
@@ -1,4 +1,4 @@
-# The interfaces file defines which interfaces
+# An interface file defines which interfaces
# will be processed by the Notify method.
- xyz.openbmc_project.Example.Iface1
diff --git a/pimgen.py b/pimgen.py
index 8e12944..95d9b72 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -49,9 +49,21 @@ if __name__ == '__main__':
for e in yaml.load(fd.read()).get('events', {}):
events.append(parse_event(e))
- # Import interfaces.yaml.
- with open(os.path.join(args.inputdir, 'interfaces.yaml'), 'r') as fd:
- interfaces = yaml.load(fd.read())
+ # Aggregate all the interface YAML in the interfaces.d
+ # directory into a single list of interfaces.
+ template = os.path.join(script_dir, 'generated.mako.cpp')
+ t = Template(filename=template)
+
+ interfaces_dir = os.path.join(args.inputdir, 'interfaces.d')
+ yaml_files = filter(
+ lambda x: x.endswith('.yaml'),
+ os.listdir(interfaces_dir))
+
+ interfaces = []
+ for x in yaml_files:
+ with open(os.path.join(interfaces_dir, x), 'r') as fd:
+ for i in yaml.load(fd.read()):
+ interfaces.append(i)
# Render the template with the provided events and interfaces.
template = os.path.join(script_dir, 'generated.mako.cpp')
OpenPOWER on IntegriCloud