]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Move the main code into a function
authorSimon Glass <sjg@chromium.org>
Fri, 24 Feb 2023 01:18:09 +0000 (18:18 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 8 Mar 2023 19:40:49 +0000 (11:40 -0800)
Put this code into a function so it is easy for it be run when packaged.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/main.py

index 6076ba5d63d25b2ef6143ca20ce9587157887df1..5e1f68d8235876e0432a81acd5b87b10a1b01c8f 100755 (executable)
@@ -46,17 +46,22 @@ def RunTests(skip_net_tests, verboose, args):
 
     return (0 if result.wasSuccessful() else 1)
 
-options, args = cmdline.ParseArgs()
+def run_buildman():
+    options, args = cmdline.ParseArgs()
 
-if not options.debug:
-    sys.tracebacklimit = 0
+    if not options.debug:
+        sys.tracebacklimit = 0
 
-# Run our meagre tests
-if options.test:
-    RunTests(options.skip_net_tests, options.verbose, args)
+    # Run our meagre tests
+    if cmdline.HAS_TESTS and options.test:
+        RunTests(options.skip_net_tests, options.verbose, args)
 
-# Build selected commits for selected boards
-else:
-    bsettings.Setup(options.config_file)
-    ret_code = control.DoBuildman(options, args)
-    sys.exit(ret_code)
+    # Build selected commits for selected boards
+    else:
+        bsettings.Setup(options.config_file)
+        ret_code = control.DoBuildman(options, args)
+        sys.exit(ret_code)
+
+
+if __name__ == "__main__":
+    run_buildman()