[Pkg-bazaar-commits] ./bzr-gtk/unstable r127: Merge warning fix from Aaron.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:49:20 UTC 2009


------------------------------------------------------------
revno: 127
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2007-01-15 03:31:28 +0100
message:
  Merge warning fix from Aaron.
modified:
  __init__.py
    ------------------------------------------------------------
    revno: 66.2.20
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: gtk
    timestamp: Tue 2007-01-02 12:27:43 -0500
    message:
      Nicer error when PyGTK not installed
    modified:
      __init__.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2006-12-20 20:56:41 +0000
+++ b/__init__.py	2007-01-02 17:27:43 +0000
@@ -25,14 +25,23 @@
 
 __version__ = '0.13.0'
 
+
+def import_pygtk():
+    try:
+        import pygtk
+    except ImportError:
+        raise errors.BzrCommandError("PyGTK not installed.")
+    pygtk.require('2.0')
+    return pygtk
+
+
 class cmd_gbranch(Command):
     """GTK+ branching.
     
     """
 
     def run(self):
-        import pygtk
-        pygtk.require("2.0")
+        pygtk = import_pygtk()
         try:
             import gtk
         except RuntimeError, e:
@@ -150,8 +159,7 @@
     aliases = ["gblame", "gpraise"]
     
     def run(self, filename, all=False, plain=False, line='1', revision=None):
-        import pygtk
-        pygtk.require("2.0")
+        pygtk = import_pygtk()
 
         try:
             import gtk
@@ -213,8 +221,7 @@
 
     def run(self, filename=None):
         import os
-        import pygtk
-        pygtk.require("2.0")
+        pygtk = import_pygtk()
 
         try:
             import gtk



More information about the Pkg-bazaar-commits mailing list