]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ci: Add helper script
authorAndrea Bolognani <abologna@redhat.com>
Tue, 16 Feb 2021 16:21:49 +0000 (17:21 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 15 Mar 2021 17:49:03 +0000 (18:49 +0100)
This is intended to be perform a number of CI-related operations
that are currently implemented in various different scripts
written in various different programming languages.

Eventually, all existing functionality will be reimplemented in
Python and made available through this single entry point; for
now, let's start with a very basic skeleton.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
ci/helper [new file with mode: 0755]

diff --git a/ci/helper b/ci/helper
new file mode 100755 (executable)
index 0000000..14ce3bb
--- /dev/null
+++ b/ci/helper
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 Red Hat, Inc.
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+import argparse
+import pathlib
+
+
+class Parser:
+    def __init__(self):
+        # Main parser
+        self.parser = argparse.ArgumentParser()
+        subparsers = self.parser.add_subparsers(
+            dest="action",
+            metavar="ACTION",
+        )
+        subparsers.required = True
+
+    def parse(self):
+        return self.parser.parse_args()
+
+
+class Application:
+    def __init__(self):
+        self.basedir = pathlib.Path(__file__).resolve().parent
+        self.args = Parser().parse()
+
+    def run(self):
+        self.args.func(self)
+
+
+if __name__ == "__main__":
+    Application().run()