summaryrefslogtreecommitdiffstats
path: root/scripts/entity_gen.py
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-08-19 12:25:54 -0700
committerPatrick Venture <venture@google.com>2019-09-19 10:20:47 -0700
commit1ad9da8a7882a643ca28fedbdc614f1855e3669a (patch)
tree2533fde8f95d730e2090fce01f32590dc3d611a5 /scripts/entity_gen.py
parent87fd2cd13314a2b0b8cbc6441e724a4fea57e20c (diff)
downloadphosphor-host-ipmid-1ad9da8a7882a643ca28fedbdc614f1855e3669a.tar.gz
phosphor-host-ipmid-1ad9da8a7882a643ca28fedbdc614f1855e3669a.zip
drop entity YAML in favor of json provided file
Step 5 of moving from entity map from YAML to JSON drops support for a built-in YAML mapping of the entity containers. Tested: Not tested. No platform upstream updates this YAML file in their builds. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ic2918f568f5a6f4a9f9135990889b3bb84a0c81d
Diffstat (limited to 'scripts/entity_gen.py')
-rwxr-xr-xscripts/entity_gen.py60
1 files changed, 0 insertions, 60 deletions
diff --git a/scripts/entity_gen.py b/scripts/entity_gen.py
deleted file mode 100755
index b558a44..0000000
--- a/scripts/entity_gen.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import sys
-import yaml
-import argparse
-from mako.template import Template
-
-
-def generate_cpp(entity_yaml, output_dir):
- with open(entity_yaml, 'r') as f:
- ifile = yaml.safe_load(f)
- if not isinstance(ifile, dict):
- ifile = {}
-
- # Render the mako template
-
- t = Template(filename=os.path.join(
- script_dir,
- "writeentity.mako.cpp"))
-
- output_cpp = os.path.join(output_dir, "entity-gen.cpp")
- with open(output_cpp, 'w') as fd:
- fd.write(t.render(entityDict=ifile))
-
-
-def main():
-
- valid_commands = {
- 'generate-cpp': generate_cpp
- }
- parser = argparse.ArgumentParser(
- description="IPMI Entity record parser and code generator")
-
- parser.add_argument(
- '-i', '--entity_yaml', dest='entity_yaml',
- default='example.yaml', help='input entity yaml file to parse')
-
- parser.add_argument(
- "-o", "--output-dir", dest="outputdir",
- default=".",
- help="output directory")
-
- parser.add_argument(
- 'command', metavar='COMMAND', type=str,
- choices=valid_commands.keys(),
- help='Command to run.')
-
- args = parser.parse_args()
-
- if (not (os.path.isfile(args.entity_yaml))):
- sys.exit("Can not find input yaml file " + args.entity_yaml)
-
- function = valid_commands[args.command]
- function(args.entity_yaml, args.outputdir)
-
-
-if __name__ == '__main__':
- script_dir = os.path.dirname(os.path.realpath(__file__))
- main()
OpenPOWER on IntegriCloud