[PATCH RFC 10/10] [RFC BOILERPLATE] scripts/get_abi.py: add support for undefined ABIs

Mauro Carvalho Chehab posted 10 patches 1 year ago
There is a newer version of this series
[PATCH RFC 10/10] [RFC BOILERPLATE] scripts/get_abi.py: add support for undefined ABIs
Posted by Mauro Carvalho Chehab 1 year ago
For this RFC, let's keep here a boilerplate, just as a reminder.

This patch contains just an skeleton for the argparse stuff. The plan
is to implement such functionality here to be able to fully replace
all get_abi.pl functionality.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/get_abi.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/scripts/get_abi.py b/scripts/get_abi.py
index 6a461f7cef32..221338c0d893 100755
--- a/scripts/get_abi.py
+++ b/scripts/get_abi.py
@@ -618,6 +618,27 @@ class AbiSearch:
         args.parser.search_symbols(args.expression)
 
 
+class AbiUndefined:
+    """
+    Initialize an argparse subparser for logic to check undefined ABI at
+    the current machine's sysfs
+    """
+
+    def __init__(self, subparsers):
+        """Initialize argparse subparsers"""
+
+        parser = subparsers.add_parser("undefined",
+                                formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+                                description="check undefined ABIs on local machine")
+
+        parser.set_defaults(func=self.run)
+
+    def run(self, args):
+        """Run subparser"""
+
+        args.parser.parse_abi()
+
+
 def main():
     """Main program"""
 
@@ -633,6 +654,7 @@ def main():
     AbiRest(subparsers)
     AbiValidate(subparsers)
     AbiSearch(subparsers)
+    AbiUndefined(subparsers)
 
     args = parser.parse_args()
 
-- 
2.47.1