[libvirt PATCH v3 03/10] ci: Add helper script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 ci/helper | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100755 ci/helper

diff --git a/ci/helper b/ci/helper
new file mode 100755
index 0000000000..2a59b8e5ab
--- /dev/null
+++ b/ci/helper
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+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()
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux