summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-05-19 19:54:52 +0000
committerSergey Udaltsov <sergey.udaltsov@gmail.com>2021-05-19 19:54:52 +0000
commitb526feb1105f53ac143f12e3c24b164053f9a23a (patch)
tree94df7b7f213c9a6227ff90591fcd2493f3ff8573 /.gitlab-ci
parent0631546f8ca18a976d5e91851673343536b46fa8 (diff)
downloadxkeyboard-config-b526feb1105f53ac143f12e3c24b164053f9a23a.tar.gz
ci: use argparse for the yaml converter script
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x.gitlab-ci/yaml-to-junit-xml.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/.gitlab-ci/yaml-to-junit-xml.py b/.gitlab-ci/yaml-to-junit-xml.py
index b297290..4e1f8a4 100755
--- a/.gitlab-ci/yaml-to-junit-xml.py
+++ b/.gitlab-ci/yaml-to-junit-xml.py
@@ -4,12 +4,25 @@
#
# This file is formatted with Python Black
+import argparse
import yaml
import sys
+import pathlib
from xml.dom import minidom
-with open(sys.argv[1]) as fd:
- yml = yaml.safe_load(open(sys.argv[1]))
+parser = argparse.ArgumentParser(description="Converts YAML to JUnit XML")
+parser.add_argument(
+ "inputfile",
+ type=pathlib.Path,
+ help="The YAML output file from the keyboard layout tester",
+)
+args = parser.parse_args()
+if not args.inputfile.exists():
+ print(f"No such file: {args.inputfile}")
+ sys.exit(0)
+
+with open(args.inputfile) as fd:
+ yml = yaml.safe_load(fd)
doc = minidom.Document()
suite = doc.createElement("testsuite")