Fix formatting issues in the registry parsing script
This removes a couple extraneous periods from the header and
updates the std::array notation with the type and size so it
will build correctly.
Tested:
Ran the script and it produced the same output as the current
base message registry header file.
Change-Id: I19908a6a5fbbafbfe84a6f8364b175bfc470d715
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
index 572fe7e..d5e83bc 100644
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -41,13 +41,21 @@
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
-include_path = os.path.realpath(os.path.join(SCRIPT_DIR, "..", "redfish-core", "include", "registries"))
+include_path = os.path.realpath(
+ os.path.join(
+ SCRIPT_DIR,
+ "..",
+ "redfish-core",
+ "include",
+ "registries"))
proxies = {
'https': os.environ.get("https_proxy", None)
}
-base_file = requests.get('https://redfish.dmtf.org/registries/Base.1.4.0.json', proxies=proxies)
+base_file = requests.get(
+ 'https://redfish.dmtf.org/registries/Base.1.4.0.json',
+ proxies=proxies)
base_file.raise_for_status()
base_json = json.loads(base_file.text)
base_path = os.path.join(include_path, "base_message_registry.hpp")
@@ -58,7 +66,7 @@
for file, json, namespace in files:
try:
os.remove(file)
- except:
+ except BaseException:
print("{} not found".format(file))
with open(file, 'w') as registry:
@@ -68,16 +76,17 @@
registry.write("\"{}\",".format(json["@Redfish.Copyright"]))
registry.write("\"{}\",".format(json["@odata.type"]))
registry.write("\"{}\",".format(json["Id"]))
- registry.write(".\"{}\",".format(json["Name"]))
+ registry.write("\"{}\",".format(json["Name"]))
registry.write("\"{}\",".format(json["Language"]))
registry.write("\"{}\",".format(json["Description"]))
- registry.write(".\"{}\",".format(json["RegistryPrefix"]))
+ registry.write("\"{}\",".format(json["RegistryPrefix"]))
registry.write("\"{}\",".format(json["RegistryVersion"]))
registry.write("\"{}\",".format(json["OwningEntity"]))
registry.write("};")
# Parse each Message entry
- registry.write("const std::array registry = {")
+ registry.write("constexpr std::array<MessageEntry, {}> registry = {{".format(
+ len(json["Messages"])))
for messageId, message in sorted(json["Messages"].items()):
registry.write("MessageEntry{")
registry.write("\"{}\",".format(messageId))