Add python3 support
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
import sys
|
||||
import errno
|
||||
import traceback
|
||||
import exceptions
|
||||
import signal
|
||||
|
||||
import pisi
|
||||
@@ -24,21 +23,24 @@ import gettext
|
||||
gettext.bindtextdomain('pisi', "/usr/share/locale")
|
||||
gettext.textdomain('pisi')
|
||||
__trans = gettext.translation('pisi', fallback=True)
|
||||
_ = __trans.ugettext
|
||||
_ = __trans.gettext
|
||||
|
||||
|
||||
def sig_handler(sig, frame):
|
||||
if sig == signal.SIGTERM:
|
||||
exit()
|
||||
|
||||
|
||||
def exit():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def handle_exception(exception, value, tb):
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN) # disable further interrupts
|
||||
ui = pisi.cli.CLI() # make a temporary UI
|
||||
ui = pisi.cli.CLI() # make a temporary UI
|
||||
show_traceback = False
|
||||
|
||||
if exception == exceptions.KeyboardInterrupt:
|
||||
if exception == KeyboardInterrupt:
|
||||
ui.error(_("Keyboard Interrupt: Exiting..."))
|
||||
exit()
|
||||
elif isinstance(value, pisi.Error):
|
||||
@@ -73,6 +75,7 @@ def handle_exception(exception, value, tb):
|
||||
|
||||
exit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.excepthook = handle_exception
|
||||
|
||||
|
||||
Reference in New Issue
Block a user