sync with pisi-cli
This commit is contained in:
+12
-1
@@ -22,11 +22,20 @@ import pisi.context as ctx
|
|||||||
import pisi.cli.pisicli as pisicli
|
import pisi.cli.pisicli as pisicli
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
gettext.bindtextdomain('pisi', "/usr/share/locale")
|
||||||
|
gettext.textdomain('pisi')
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
|
def sig_handler(sig, frame):
|
||||||
|
if sig == signal.SIGTERM:
|
||||||
|
exit()
|
||||||
|
|
||||||
def exit():
|
def exit():
|
||||||
pisi.api.finalize()
|
try:
|
||||||
|
pisi.api.finalize()
|
||||||
|
except KeyboardInterrupt: # raised pending interrupt
|
||||||
|
pass
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def handle_exception(exception, value, tb):
|
def handle_exception(exception, value, tb):
|
||||||
@@ -73,6 +82,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
sys.excepthook = handle_exception
|
sys.excepthook = handle_exception
|
||||||
|
|
||||||
|
signal.signal(signal.SIGTERM, sig_handler)
|
||||||
|
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
cli = pisicli.PisiCLI()
|
cli = pisicli.PisiCLI()
|
||||||
cli.run_command()
|
cli.run_command()
|
||||||
|
|||||||
Reference in New Issue
Block a user