[pessulus] [pessulus] Mostly revert 72b2dbcd and do it the right way



commit 0cb036921671fa72881955ff3cfc447841629d29
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Jun 22 04:14:48 2010 +0200

    [pessulus] Mostly revert 72b2dbcd and do it the right way
    
    The fact that the bugbuddy module is not there is not big issue, so just
    ignore the fact that the import failed.
    
    Also, add a mention at the end of configure for packagers.

 Pessulus/main.py |   40 +++-------------------------------------
 configure.ac     |    9 ++-------
 pessulus.in      |    8 ++++++--
 3 files changed, 11 insertions(+), 46 deletions(-)
---
diff --git a/Pessulus/main.py b/Pessulus/main.py
index 123f0f6..c3092bb 100644
--- a/Pessulus/main.py
+++ b/Pessulus/main.py
@@ -20,53 +20,19 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
 #
 
-import gtk
-
-def __try_import__(modulename):
-    """
-    Attempt to load given module.
-    Returns True on success, else False.
-    """
-    try:
-        __import__(modulename)
-        return True
-    except:
-        return False
-
-def initial_checks():
-    if not __try_import__("bugbuddy"):
-        return (_("Could not import the bugbuddy Python bindings"),
-                _("Make sure you have the bugbuddy Python bindings installed"))
-
-def _checkDependencies():
-    missing_deps = initial_checks()
-    if missing_deps:
-        message, detail = missing_deps
-        dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
-                                   buttons=gtk.BUTTONS_OK)
-        dialog.set_markup("<b>"+message+"</b>")
-        dialog.format_secondary_text(detail)
-        dialog.run()
-
-        return False
-    return True
-
-
 def main (args):
     import gettext
     import locale
     import sys
 
     import pygtk; pygtk.require('2.0');
-    
+
+    import gtk
+
     import maindialog
     import lockdownappliergconf
     import config
 
-    # check for dependencies
-    if not _checkDependencies():
-        return
-
     try:
         locale.setlocale (locale.LC_ALL, "")
     except locale.Error:
diff --git a/configure.ac b/configure.ac
index a2e539e..6787877 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,13 +13,6 @@ AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")
 
 PKG_CHECK_MODULES([PESSULUS], [pygtk-2.0 >= 2.13.0])
 
-dnl Note for packagers
-dnl The following requirements are run-time requirements,
-dnl make sure you don't forget them, even though you're able to
-dnl build pitivi without them.
-#
-# bugbuddy python module
-
 GETTEXT_PACKAGE=pessulus
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
@@ -71,4 +64,6 @@ echo "
 
         GConf source for mandatory values:  ${GCONF_MANDATORY_SOURCE}
 
+Those python modules are optional runtime dependencies:
+ bugbuddy (from gnome-python-desktop)
 "
diff --git a/pessulus.in b/pessulus.in
index 030c605..80cf38d 100644
--- a/pessulus.in
+++ b/pessulus.in
@@ -20,9 +20,13 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 import sys
-import bugbuddy
 
-bugbuddy.install()
+try:
+    import bugbuddy
+    bugbuddy.install()
+except:
+    # bugbuddy is optional, so it's not an issue if it's not there
+    pass
 
 if not "@pythondir@" in sys.path:
     sys.path.insert (0, "@pythondir@")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]