From: Andrew Cooper Date: Tue, 2 Aug 2016 18:08:43 +0000 (+0100) Subject: mkinfo: Fix JSON damage from splitting an empty string X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=afae0848ef54dba62e6fe6edfb3cbd656db2d1f8;p=people%2Fliuw%2Fxtf.git mkinfo: Fix JSON damage from splitting an empty string In python, splitting an empty string results in a single-entry list containing an empty string. This causes the variations list to be wrong when no variations are in use. It is only by chance that doesn't cause an issue for ./xtf-runner Signed-off-by: Andrew Cooper --- diff --git a/build/mkinfo.py b/build/mkinfo.py index 02567e5..94891a9 100644 --- a/build/mkinfo.py +++ b/build/mkinfo.py @@ -9,10 +9,15 @@ _, out, name, cat, envs, variations = sys.argv template = { "name": name, "category": cat, - "environments": envs.split(" "), - "variations": variations.split(" "), + "environments": [], + "variations": [], } +if envs: + template["environments"] = envs.split(" ") +if variations: + template["variations"] = variations.split(" ") + open(out, "w").write( json.dumps(template, indent=4, separators=(',', ': ')) + "\n"