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 """
diff --git a/tfm_ci_pylib/tfm_build_manager.py b/tfm_ci_pylib/tfm_build_manager.py
index 8eac0a4..4ce848a 100644
--- a/tfm_ci_pylib/tfm_build_manager.py
+++ b/tfm_ci_pylib/tfm_build_manager.py
@@ -194,7 +194,7 @@
# Merge the two dictionaries since the template may contain
# fixed and combinations seed parameters
cmd0 = build_cfg["config_template"] % \
- {**dict(i._asdict()), **build_cfg}
+ dict(dict(i._asdict()), **build_cfg)
# Prepend configuration commoand as the first cmd
build_cfg["build_cmds"] = [cmd0] + build_cfg["build_cmds"]
@@ -466,7 +466,7 @@
static_config)
# Append the configuration to the existing ones
- rejection_cfg = {**rejection_cfg, **rj_cfg}
+ rejection_cfg = dict(rejection_cfg, **rj_cfg)
# Notfy the user for the rejected configuations
for i in rejection_cfg.keys():
diff --git a/tfm_ci_pylib/utils.py b/tfm_ci_pylib/utils.py
index 2096b8b..5df108a 100755
--- a/tfm_ci_pylib/utils.py
+++ b/tfm_ci_pylib/utils.py
@@ -29,7 +29,6 @@
import argparse
import json
import itertools
-import xmltodict
from shutil import move
from collections import OrderedDict, namedtuple
from subprocess import Popen, PIPE, STDOUT, check_output
@@ -532,18 +531,6 @@
return dir_path
-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 list_filtered_tree(directory, rex_filter=None):
ret = []
for path, subdirs, files in os.walk(directory):