Increase compatibility
As configs.py may be run by CI systems without the full python
requirements needed by the build, this aims to increase the
compatibility.
* xmltodict only required by one function in the utils.py, but it was
only used by the report parser, so moved that to the report parser.
* Changed some lines combining dictionaries to be python 2 and 3
compatible.
Change-Id: I1c54d0d5ee8d5995a6a62b8102b40071a50decb7
Signed-off-by: Dean Birch <dean.birch@arm.com>
diff --git a/report_parser/report_parser.py b/report_parser/report_parser.py
index e33435f..95af3f2 100644
--- a/report_parser/report_parser.py
+++ b/report_parser/report_parser.py
@@ -32,6 +32,7 @@
import sys
import json
import argparse
+import xmltodict
from pprint import pprint
try:
@@ -47,6 +48,18 @@
convert_git_ref_path, xml_read
+def xml_read(file):
+ """" Read the contects of an xml file and convert it to python object """
+
+ data = None
+ try:
+ with open(file, "r") as F:
+ data = xmltodict.parse(F.read())
+ except Exception as E:
+ print("Error", E)
+ return data
+
+
def split_keys(joint_arg, sep="="):
""" Split two keys spread by a separator, and return them as a tuple
with whitespace removed """