python-sqlite2 retirement/orphaning

Toshio Kuratomi a.badger at gmail.com
Tue Feb 7 21:34:02 UTC 2012


On Tue, Feb 07, 2012 at 09:35:20PM +0100, Michael Schwendt wrote:
> On Tue, 7 Feb 2012 10:08:03 -0800, TK (Toshio) wrote:
> 
> > There is one package that actually has a code dependency on pysqlite2.  I've
> > submitted a patch and asked someone I know who uses the package to test it:
> > 
> > * plague https://bugzilla.redhat.com/show_bug.cgi?id=788189
> 
> Last time Plague has been adjusted to use sqlite3, some more items
> required a patch:
> http://mschwendt.fedorapeople.org/plague/patches/plague-0.4.4.1-sqlite3.patch
> 
> It could be that these are still valid, but it might be that I won't
> manage to test prior to this weekend.
>
Thanks!  I took a look at your patch and it looks like it was integrated
upstream.  Most of it verbatim.  The one part I'm not 100% sure of is the
changes to UserInterface.py.  I don't know what the code looked like that
the patch applies against but I think that equivalent changes were merged
into DBManager.py instead.

The current code uses pysqlite2 with imports like this:

try:
    from pysqlite2 import _sqlite as sqlite
except ImportError:
    import sqlite

Since sqlite3 is supposed to be a slightly older version of pysqlite2,
I updated the import to look like this:

try:
    from pysqlite2 import _sqlite as sqlite
except ImportError:
    try:
        import _sqlite3 as sqlite
    except ImportError:
        import sqlite

After looking at your patch, there might not be any reason to import the
compiled portion of the extension directly -- it might be okay to do this:

try:
    from pysqlite2 import dbapi2 as sqlite
except ImportError:
    try:
        import sqlite3 as sqlite
    except ImportError:
        import sqlite

I haven't looked at the python code in those modules closely, I just assumed
that the pysqlite2 code was working already so the sqlite3 module had
a higher chance of working out of the box if I accessed it in the same way.

-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20120207/ce30eb04/attachment.sig>


More information about the devel mailing list