]> granicus.if.org Git - python/commitdiff
Support for BerkeleyDB 4.4 (tested against 4.4.20 as well as all the
authorGregory P. Smith <greg@mad-scientist.com>
Tue, 24 Jan 2006 09:46:48 +0000 (09:46 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Tue, 24 Jan 2006 09:46:48 +0000 (09:46 +0000)
way back thru 3.2).  This should be backported to the release24-maint
branch.

Modules/_bsddb.c
setup.py

index aa4a1617cb5cff871ec68429d24778321eda7967..104774547b100f94c5caaa439b1a523a29657785 100644 (file)
@@ -97,7 +97,7 @@
 #error "eek! DBVER can't handle minor versions > 9"
 #endif
 
-#define PY_BSDDB_VERSION "4.3.3"
+#define PY_BSDDB_VERSION "4.4.0"
 static char *rcs_id = "$Id$";
 
 
@@ -4308,8 +4308,13 @@ DBEnv_lock_stat(DBEnvObject* self, PyObject* args)
 #endif
     MAKE_ENTRY(nrequests);
     MAKE_ENTRY(nreleases);
-    MAKE_ENTRY(nnowaits);
+#if (DBVER < 44)
+    MAKE_ENTRY(nnowaits);       /* these were renamed in 4.4 */
     MAKE_ENTRY(nconflicts);
+#else
+    MAKE_ENTRY(lock_nowait);
+    MAKE_ENTRY(lock_wait);
+#endif
     MAKE_ENTRY(ndeadlocks);
     MAKE_ENTRY(regsize);
     MAKE_ENTRY(region_wait);
@@ -5153,7 +5158,11 @@ DL_EXPORT(void) init_bsddb(void)
     ADD_INT(d, DB_LOCK_IREAD);
     ADD_INT(d, DB_LOCK_IWR);
 #if (DBVER >= 33)
+#if (DBVER < 44)
     ADD_INT(d, DB_LOCK_DIRTY);
+#else
+    ADD_INT(d, DB_LOCK_READ_UNCOMMITTED);  /* renamed in 4.4 */
+#endif
     ADD_INT(d, DB_LOCK_WWRITE);
 #endif
 
@@ -5255,6 +5264,11 @@ DL_EXPORT(void) init_bsddb(void)
     ADD_INT(d, DB_MULTIPLE_KEY);
 #endif
 
+#if (DBVER >= 44)
+    ADD_INT(d, DB_READ_UNCOMMITTED);    /* replaces DB_DIRTY_READ in 4.4 */
+    ADD_INT(d, DB_READ_COMMITTED);
+#endif
+
 #if (DBVER >= 33)
     ADD_INT(d, DB_DONOTINDEX);
 #endif
index 22f25308a6602bc271ff174aebacf60672ebd7cd..7481dd779af40d3293dc298a999499d5a44fec21 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -556,12 +556,12 @@ class PyBuildExt(build_ext):
         # Sleepycat Berkeley DB interface.  http://www.sleepycat.com
         #
         # This requires the Sleepycat DB code. The earliest supported version
-        # of that library is 3.2, the latest supported version is 4.3.  A list
+        # of that library is 3.2, the latest supported version is 4.4.  A list
         # of available releases can be found at
         #
         # http://www.sleepycat.com/update/index.html
 
-        max_db_ver = (4, 3)
+        max_db_ver = (4, 4)
         min_db_ver = (3, 2)
         db_setup_debug = False   # verbose debug prints from this script?
 
@@ -578,18 +578,20 @@ class PyBuildExt(build_ext):
             '/sw/include/db3',
         ]
         # 4.x minor number specific paths
-        for x in (0,1,2,3):
+        for x in (0,1,2,3,4):
             db_inc_paths.append('/usr/include/db4%d' % x)
             db_inc_paths.append('/usr/include/db4.%d' % x)
             db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
             db_inc_paths.append('/usr/local/include/db4%d' % x)
             db_inc_paths.append('/pkg/db-4.%d/include' % x)
+            db_inc_paths.append('/opt/db-4.%d/include' % x)
         # 3.x minor number specific paths
         for x in (2,3):
             db_inc_paths.append('/usr/include/db3%d' % x)
             db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
             db_inc_paths.append('/usr/local/include/db3%d' % x)
             db_inc_paths.append('/pkg/db-3.%d/include' % x)
+            db_inc_paths.append('/opt/db-3.%d/include' % x)
 
         db_ver_inc_map = {}