[meld] Extend missing_reqs() to report both import errors and requirements
- From: Kai Willadsen <kaiw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [meld] Extend missing_reqs() to report both import errors and requirements
- Date: Sat, 10 Oct 2009 22:04:33 +0000 (UTC)
commit 888a3907f197c5090efd258e5301cd414cad2293
Author: Kai Willadsen <kai willadsen gmail com>
Date: Thu Jul 9 10:22:55 2009 +1000
Extend missing_reqs() to report both import errors and requirements
bin/meld | 29 +++++++++++++----------------
1 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index 129660c..fd56cde 100755
--- a/bin/meld
+++ b/bin/meld
@@ -49,37 +49,34 @@ gettext.textdomain("meld")
pyver = (2,4)
pygtkver = (2,8,0)
-def missing_reqs(mod, ver):
- modver = mod + " " + ".".join(map(str, ver))
- print _("Meld requires %s or higher.") % modver
+def missing_reqs(mod, ver, exception=None):
+ if isinstance(exception, ImportError):
+ print _("Cannot import: ") + mod + "\n" + e
+ else:
+ modver = mod + " " + ".".join(map(str, ver))
+ print _("Meld requires %s or higher.") % modver
sys.exit(1)
if sys.version_info[:2] < pyver:
missing_reqs("Python", pyver)
+# gtk+ and related imports
try:
import pygtk
pygtk.require("2.0")
-except ImportError, e:
- print e
- missing_reqs("pygtk", pygtkver)
+except (ImportError, AssertionError), e:
+ missing_reqs("pygtk", pygtkver, e)
try:
import gtk
-except ImportError, e:
- print e
- print _("Cannot import: ") + "gtk"
- sys.exit(1)
+ assert gtk.pygtk_version >= pygtkver
+except (ImportError, AssertionError), e:
+ missing_reqs("pygtk", pygtkver, e)
try:
import gtk.glade
except ImportError, e:
- print e
- print _("Cannot import: ") + "gtk.glade"
- sys.exit(1)
-
-if gtk.pygtk_version < pygtkver:
- missing_reqs("pygtk", pygtkver)
+ missing_reqs("gtk.glade", pygtkver, e)
# Ignore deprecation warnings from pygtk > 2.6
#if gtk.pygtk_version >= (2,8,0):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]