patman: Tidy up the start-up code
Much of this was written before the other Python tools and they have
evolved. Make a few updates:
- Rather than calling sys.exit(), return the exit code from the control
module and use it in __main__
- Set up tout as it is used in some places
- We now have quite a few tests, so update the comment about that
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/patman/__main__.py b/tools/patman/__main__.py
index db78ea6..6aadf76 100755
--- a/tools/patman/__main__.py
+++ b/tools/patman/__main__.py
@@ -15,6 +15,7 @@
sys.path.append(os.path.join(our_path, '..'))
# Our modules
+from u_boot_pylib import tout
from patman import cmdline
from patman import control
from u_boot_pylib import test_util
@@ -31,7 +32,9 @@
if not args.debug:
sys.tracebacklimit = 0
- # Run our meagre tests
+ tout.init(tout.INFO if args.verbose else tout.WARNING)
+
+ # Run our reasonably good tests
if args.cmd == 'test':
# pylint: disable=C0415
from patman import func_test
@@ -46,7 +49,8 @@
# Process commits, produce patches files, check them, email them
else:
- control.do_patman(args)
+ exit_code = control.do_patman(args)
+ sys.exit(exit_code)
if __name__ == "__main__":