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

Submitted by git@git.openembedded.org on Jan. 20, 2012, 4:57 p.m. | Patch ID: 19845


Message ID 20120120165748.A6D951033A@opal
State Not Applicable
Headers show

Commit Message

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 hide | download patch | download mbox

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
+    import sqlite3
+except ImportError:
+    from pysqlite2 import dbapi2 as sqlite3
 import bb.server.xmlrpc
 import prserv