tweak (correct exit status for pathological case of no DISPLAY)

This commit is contained in:
Paul Franklin 2016-10-10 10:13:21 -07:00
parent 0966f63c34
commit 44b0837d4d

View File

@ -89,12 +89,12 @@ try:
from gi.repository import Pango, PangoCairo from gi.repository import Pango, PangoCairo
from gi.repository import Gtk, Gdk from gi.repository import Gtk, Gdk
except (ImportError, ValueError): except (ImportError, ValueError):
print((_("Gdk, Gtk, Pango or PangoCairo typelib not installed.\n" print(_("Gdk, Gtk, Pango or PangoCairo typelib not installed.\n"
"Install Gnome Introspection, and " "Install Gnome Introspection, and "
"pygobject version 3.12 or later.\n" "pygobject version 3.12 or later.\n"
"Then install introspection data for Gdk, Gtk, Pango and " "Then install introspection data for Gdk, Gtk, Pango and "
"PangoCairo\n\n" "PangoCairo\n\n"
"Gramps will terminate now."))) "Gramps will terminate now."))
sys.exit(1) sys.exit(1)
GTK_MAJOR = Gtk.get_major_version() GTK_MAJOR = Gtk.get_major_version()
@ -111,9 +111,9 @@ if (GTK_MAJOR, GTK_MINOR) < MIN_GTK_VERSION:
try: try:
import cairo import cairo
except ImportError: except ImportError:
print((_("\ncairo python support not installed. " print(_("\ncairo python support not installed. "
"Install cairo for your version of python\n\n" "Install cairo for your version of python\n\n"
"Gramps will terminate now."))) "Gramps will terminate now."))
sys.exit(1) sys.exit(1)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -362,9 +362,9 @@ def __startgramps(errors, argparser):
if has_display(): if has_display():
Gramps(argparser) Gramps(argparser)
else: else:
print("Gramps terminated because of no DISPLAY") print(_("Gramps terminated because of no DISPLAY"))
sys.exit(exit_code) quit_now = True
exit_code = 1
except SystemExit as err: except SystemExit as err:
quit_now = True quit_now = True
if err.code: if err.code:
@ -380,7 +380,6 @@ def __startgramps(errors, argparser):
fname = "" fname = ""
LOG.error("Gramps terminated because of OS Error\n" + LOG.error("Gramps terminated because of OS Error\n" +
"Error details: %s %s", repr(err), fname, exc_info=True) "Error details: %s %s", repr(err), fname, exc_info=True)
except: except:
quit_now = True quit_now = True
exit_code = 1 exit_code = 1