Allow cache.sqlite to use sqlite3 from python-2.5, if available.
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Sep 2006 19:50:27 +0000 (19:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 22 Sep 2006 19:50:27 +0000 (19:50 -0000)
svn path=/main/trunk/; revision=4498

pym/cache/sqlite.py

index 78d4cd6499274c217f95e2f315143a44151db0ec..40b0b9a9e63c53559ccd88e5f611d8f3806910ff 100644 (file)
@@ -9,7 +9,10 @@ from cache.mappings import LazyLoad, ProtectedDict
 from cache.template import reconstruct_eclasses
 from portage_util import writemsg, apply_secpass_permissions
 from portage_data import portage_gid
-from pysqlite2 import dbapi2 as db_module
+try:
+       import sqlite3 as db_module # sqlite3 is optional with >=python-2.5
+except ImportError:
+       from pysqlite2 import dbapi2 as db_module
 DBError = db_module.Error
 
 class database(fs_template.FsBased):