[PATCH 2/5] Drop vestigial compat.wrap_main

0 views
Skip to first unread message

Rob Browning

unread,
May 17, 2024, 2:40:50 PMMay 17
to bup-...@googlegroups.com
Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---
Pushed to main.

lib/bup/compat.py | 11 -----------
lib/bup/main.py | 10 +++++-----
2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/lib/bup/compat.py b/lib/bup/compat.py
index 894e27fc1..af5d73b59 100644
--- a/lib/bup/compat.py
+++ b/lib/bup/compat.py
@@ -63,14 +63,3 @@ else:
raise Exception('get_argvb requires the bup_main module');
def get_argv():
raise Exception('get_argv requires the bup_main module');
-
-def wrap_main(main):
- """Run main() and raise a SystemExit with the return value if it
- returns, pass along any SystemExit it raises, convert
- KeyboardInterrupts into exit(130), and print a Python 3 style
- contextual backtrace for other exceptions in both Python 2 and
- 3)."""
- try:
- sys.exit(main())
- except KeyboardInterrupt as ex:
- sys.exit(130)
diff --git a/lib/bup/main.py b/lib/bup/main.py
index 385c51395..f87769352 100755
--- a/lib/bup/main.py
+++ b/lib/bup/main.py
@@ -1,6 +1,4 @@

-from __future__ import absolute_import, print_function
-
import bup_main, os, sys
if bup_main.env_pythonpath:
if sys.version_info[0] < 3:
@@ -19,8 +17,7 @@ import re, select, signal, subprocess
from bup import compat, path, helpers
from bup.compat import (
environ,
- fsdecode,
- wrap_main
+ fsdecode
)
from bup.helpers import (
columnate,
@@ -388,7 +385,10 @@ def run_subcmd(module, args):
run_subproc_cmd(args)

def main():
- wrap_main(lambda : run_subcmd(cmd_module, subcmd))
+ try:
+ sys.exit(run_subcmd(cmd_module, subcmd))
+ except KeyboardInterrupt as ex:
+ sys.exit(130)

if __name__ == "__main__":
main()
--
2.43.0

Reply all
Reply to author
Forward
0 new messages