PEL: Update process_registry.py for python3
The 2to3 program found the places to change, but I didn't use its
suggestions as this is a cleaner way to do it.
Note that this doesn't run during a bitbake or SDK build, but it does
run during CI.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I0c62a832b3249f7dcf4dc67fd0e56ad76367b10a
diff --git a/extensions/openpower-pels/registry/tools/process_registry.py b/extensions/openpower-pels/registry/tools/process_registry.py
index 09ad3e0..24026c3 100755
--- a/extensions/openpower-pels/registry/tools/process_registry.py
+++ b/extensions/openpower-pels/registry/tools/process_registry.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import argparse
import json
@@ -20,12 +20,12 @@
registry_json: The message registry JSON
"""
- names = {}
+ names = []
for entry in registry_json['PELs']:
- if entry['Name'] in names.keys():
+ if entry['Name'] in names:
sys.exit("Found multiple uses of error {}".format(entry['Name']))
else:
- names[entry['Name']] = {}
+ names.append(entry['Name'])
def check_duplicate_reason_codes(registry_json):
@@ -36,13 +36,13 @@
registry_json: The message registry JSON
"""
- reasonCodes = {}
+ reasonCodes = []
for entry in registry_json['PELs']:
- if entry['SRC']['ReasonCode'] in reasonCodes.keys():
+ if entry['SRC']['ReasonCode'] in reasonCodes:
sys.exit("Found duplicate SRC reason code {}".format(
entry['SRC']['ReasonCode']))
else:
- reasonCodes[entry['SRC']['ReasonCode']] = {}
+ reasonCodes.append(entry['SRC']['ReasonCode'])
def check_component_id(registry_json):