Patchwork [bitbake-devel] Martin Jansa : prserv: fix import of sqlite3

login
register
mail settings
Submitter git@git.openembedded.org
Date Jan. 20, 2012, 4:57 p.m.
Message ID <20120120165748.A6D951033A@opal>
Download mbox | patch
Permalink /patch/19845/
State Not Applicable
Headers show

Comments

git@git.openembedded.org - Jan. 20, 2012, 4:57 p.m.
Module: bitbake.git
Branch: master
Commit: 9a57ec705cf5c932d8c2a35852db7a4627c57937
URL:    http://git.openembedded.org/?p=bitbake.git&a=commit;h=9a57ec705cf5c932d8c2a35852db7a4627c57937

Author: Martin Jansa <martin.jansa@gmail.com>
Date:   Sun Jan 15 22:03:53 2012 +0100

prserv: fix import of sqlite3

* this is used in all other bitbake parts where sqlite3 is used, don't
  know why it wasn't used here, but it fails e.g. on Gentoo
  Traceback (most recent call last):
    File "bin/bitbake", line 39, in <module>
      from bb import cooker
    File "lib/bb/cooker.py", line 39, in <module>
      import prserv.serv
    File "lib/prserv/serv.py", line 4, in <module>
      import xmlrpclib,sqlite3
  ImportError: No module named sqlite3

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

---

 lib/prserv/serv.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Patch

diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index a759fa7..fa437f9 100644
--- a/lib/prserv/serv.py
+++ b/lib/prserv/serv.py
@@ -1,7 +1,12 @@ 
 import os,sys,logging
 import signal, time, atexit, threading
 from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
-import xmlrpclib,sqlite3
+import xmlrpclib
+
+try:
+    import sqlite3
+except ImportError:
+    from pysqlite2 import dbapi2 as sqlite3
 
 import bb.server.xmlrpc
 import prserv