billreminder r675 - in trunk: . src/daemon src/gui src/lib



Author: ogmaciel
Date: Fri Oct 24 01:42:31 2008
New Revision: 675
URL: http://svn.gnome.org/viewvc/billreminder?rev=675&view=rev

Log:
Import sqlite3 if using python 2.5, or pysqlite2 if using python 2.4. Fixes Bug #555136

Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/daemon/main.py
   trunk/src/gui/aboutdialog.py
   trunk/src/lib/dal.py

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Oct 24 01:42:31 2008
@@ -32,7 +32,43 @@
 AC_SUBST(VERSION)
 
 AM_CHECK_PYMOD([gobject], , , AC_MSG_ERROR([Python module gobject required to run BillReminder]))
-AM_CHECK_PYMOD_VERSION([pysqlite2.dbapi2], [version], [2.3.0], , AC_MSG_ERROR([Python module pysqlite2 >= 2.3.0 required to run BillReminder]))
+
+dnl This entire python check section borrowed from the hamster-applet project.
+if test "x$PYTHON_VERSION" = "x2.5"; then
+    AC_MSG_CHECKING([for python sqlite module])
+    if AC_RUN_LOG([DISPLAY= $PYTHON -c '
+try:
+    import sqlite3
+except ImportError, e:
+    if str(e).find("sqlite3") >= 0:
+        raise
+except:
+    pass
+    ']); then
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([Python 2.5: inbuilt sqlite is required to build BillReminder])
+    fi
+else
+    AC_MSG_CHECKING([for pysqlite2 module])
+    if AC_RUN_LOG([DISPLAY= $PYTHON -c '
+try:
+    import pysqlite2
+except ImportError, e:
+    if str(e).find("pysqlite2") >= 0:
+        raise
+except:
+    pass
+    ']); then
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([Python 2.4: pysqlite2 module required to build BillReminder])
+    fi
+fi
+
+
 AM_CHECK_PYMOD([dbus], , , AC_MSG_ERROR([Python module dbus required to run BillReminder]))
 
 AC_PATH_PROG(GCONFTOOL, gconftool-2)

Modified: trunk/src/daemon/main.py
==============================================================================
--- trunk/src/daemon/main.py	(original)
+++ trunk/src/daemon/main.py	Fri Oct 24 01:42:31 2008
@@ -16,11 +16,6 @@
 except ImportError:
     print 'Required package: dbus-python'
     raise SystemExit
-try:
-    import pysqlite2
-except ImportError:
-    print 'Required package: pysqlite2'
-    raise SystemExit
 
 from lib import common
 from lib import i18n
@@ -67,34 +62,6 @@
     """ Make the program run like a daemon """
     def __init__(self, options):
         """ Detach process and run it as a daemon """
-        """
-        if not options.app_nodaemon:
-            # Fork first child
-            try:
-                pid = os.fork()
-            except OSError, err:
-                print >> sys.stderr, \
-                         ('Unexpected error:', sys.exc_info()[0], err)
-
-            if pid == 0:
-                os.setsid()
-
-                # Fork second child
-                try:
-                    pid = os.fork()
-                except OSError, err:
-                    print >> sys.stderr, \
-                             ('Unexpected error:', sys.exc_info()[0], err)
-
-                if pid == 0:
-                    os.umask(0)
-                else:
-                    raise SystemExit
-            else:
-                raise SystemExit
-            # Redirect STDIN, STDOUT and STDERR
-            sys.stdin.close()
-        """
         if options.app_verbose:
             sys.stdout.write('\n')
             sys.stdout = VerboseDevice(type_='stdout')

Modified: trunk/src/gui/aboutdialog.py
==============================================================================
--- trunk/src/gui/aboutdialog.py	(original)
+++ trunk/src/gui/aboutdialog.py	Fri Oct 24 01:42:31 2008
@@ -12,8 +12,8 @@
 from lib import i18n
 
 try:
-  import gnome
-  def open_url(url): gnome.url_show(url)
+  import gnomevfs
+  def open_url(url): gnomevfs.url_show(url)
 except:
   import os
   def open_url(url): os.system("xdg-open %s" % url)

Modified: trunk/src/lib/dal.py
==============================================================================
--- trunk/src/lib/dal.py	(original)
+++ trunk/src/lib/dal.py	Fri Oct 24 01:42:31 2008
@@ -6,10 +6,13 @@
 import sys
 
 try:
-    from pysqlite2 import dbapi2 as sqlite
+    import sqlite3 as sqlite
 except ImportError:
-    print "Please install pysqlite2"
-    sys.exit(1)
+    try:
+        from pysqlite2 import dbapi2 as sqlite
+    except ImportError:
+        print "Please install pysqlite2"
+        sys.exit(1)
 
 from lib.bill import Bill
 from lib.common import DB_NAME, DB_PATH



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