temporary testing cli which uses python2.5 (python-bsdbd3 and piksemel must installed with hand)
This commit is contained in:
Executable
+78
@@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/python2.5
|
||||||
|
#
|
||||||
|
# Copyright (C) 2005, TUBITAK/UEKAE
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it under
|
||||||
|
# the terms of the GNU General Public License as published by the Free
|
||||||
|
# Software Foundation; either version 2 of the License, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# Please read the COPYING file.
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import locale
|
||||||
|
import traceback
|
||||||
|
import exceptions
|
||||||
|
import signal
|
||||||
|
import bsddb3.db as db
|
||||||
|
|
||||||
|
import pisi.ui
|
||||||
|
import pisi.context as ctx
|
||||||
|
import pisi.cli.pisicli as pisicli
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
|
_ = __trans.ugettext
|
||||||
|
|
||||||
|
def exit():
|
||||||
|
pisi.api.finalize()
|
||||||
|
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
|
||||||
|
show_traceback = False
|
||||||
|
if exception == exceptions.KeyboardInterrupt:
|
||||||
|
ui.error(_("Keyboard Interrupt: Exiting..."))
|
||||||
|
exit()
|
||||||
|
elif isinstance(value, pisi.Error):
|
||||||
|
ui.error(_("Program Terminated."))
|
||||||
|
show_traceback = ctx.get_option('debug')
|
||||||
|
elif isinstance(value, db.DBRunRecoveryError):
|
||||||
|
ui.error(_("""A database operation has been aborted. You should run pisi
|
||||||
|
again for normal DB recovery procedure. Make sure you have free disk space.
|
||||||
|
You have to run rebuild-db only when there is file corruption and database upgrades."""))
|
||||||
|
elif isinstance(value, pisi.Exception):
|
||||||
|
show_traceback = True
|
||||||
|
ui.error(_("""Unhandled internal exception.
|
||||||
|
Please file a bug report. (http://bugs.uludag.org.tr)"""))
|
||||||
|
else:
|
||||||
|
# For any other exception (possibly Python exceptions) show
|
||||||
|
# the traceback!
|
||||||
|
show_traceback = ctx.get_option('debug')
|
||||||
|
ui.error(_("System Error. Program Terminated."))
|
||||||
|
|
||||||
|
if ctx.get_option('debug'):
|
||||||
|
ui.error(u"%s: %s" % (exception, value))
|
||||||
|
else:
|
||||||
|
ui.error(unicode(value))
|
||||||
|
|
||||||
|
ui.info(_("Please use 'pisi help' for general help."))
|
||||||
|
|
||||||
|
if show_traceback:
|
||||||
|
ui.info(_("Traceback:"))
|
||||||
|
traceback.print_tb(tb)
|
||||||
|
else:
|
||||||
|
if not exception is pisicli.Error:
|
||||||
|
ui.info(_("Use --debug to see a traceback."))
|
||||||
|
|
||||||
|
exit()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
sys.excepthook = handle_exception
|
||||||
|
|
||||||
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
cli = pisicli.PisiCLI()
|
||||||
|
cli.run_command()
|
||||||
Reference in New Issue
Block a user