Felix Kronlage a écrit :
On Fri, Apr 18, 2008 at 11:20:51PM +0200, Xavier Venient wrote:

 There are plugins available for trac, that require that trac runs with
 an sqlite3. Besides that, running trac with sqlite3 seems to be the
 de-facto standard out there.
don't know about trac, but python2.5 includes sqlite3 which is built
separately on openbsd (as a pseudo flavor?), so 'standard' dependency
should be python-sqlite.

From my understanding, trac explicitly requires py-sqlite.
See also: <url: http://trac.edgewall.org/wiki/PySqlite>

felix

Hi,
Now sqlite3 is included in python2.5, see http://docs.python.org/lib/module-sqlite3.html

with following change you can run trac:

Index: Makefile
===================================================================
RCS file: /cvs/openbsd/ports/www/trac/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- Makefile    8 Oct 2007 08:22:43 -0000       1.13
+++ Makefile    20 Apr 2008 10:31:18 -0000
@@ -21,7 +21,7 @@

 MODULES=       lang/python

-MY_DEPENDS=    ::databases/py-sqlite \
+MY_DEPENDS=    :python-sqlite-*:lang/python/${MODPY_VERSION},-sqlite \
                ::devel/subversion,-python \
                ::textproc/py-docutils \
                ::www/clearsilver,python



Python 2.5.2 (r252:60911, Apr 16 2008, 11:34:27)
[GCC 3.3.5 (propolice)] on openbsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import trac.db.sqlite_backend as test
>>> test._ver
(3, 4, 2)
>>> test.have_pysqlite
2
>>> test.sqlite.version
'2.3.2'
>>> from pysqlite2 import dbapi2 as sqlite
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pysqlite2
>>> import sqlite3 as sqlite


Last line show how to import new sqlite3 included in python2.5. Note that this module is the same as pysqlite2 :)

Look at trac/db/sqlite_backend.py (i've added XXX):

try:
    # XXX pysqlite2 module
    import pysqlite2.dbapi2 as sqlite
    have_pysqlite = 2
except ImportError:
    try:
        # XXX pythn2.5
        import sqlite3 as sqlite
        have_pysqlite = 2
    except ImportError:
        try:
            # XXX pysqlite?
            import sqlite
            have_pysqlite = 1
        except ImportError:
            have_pysqlite = 0



(Rencent) python code using sqlite should at least test for sqlite3 or pysqlite2 module.


Reply via email to