summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2007-01-05 01:59:42 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2007-01-05 01:59:42 (GMT)
commit8b96a35d14c0ec5db5f32321e544269a5b0a8759 (patch)
treee34f90949bb24daab02c775616f5e96875f1da5a
parent7b7c9d420817e5ffb5fd3adbc19a9be4ba0f4604 (diff)
downloadcpython-8b96a35d14c0ec5db5f32321e544269a5b0a8759.zip
cpython-8b96a35d14c0ec5db5f32321e544269a5b0a8759.tar.gz
cpython-8b96a35d14c0ec5db5f32321e544269a5b0a8759.tar.bz2
Support linking of the bsddb module against BerkeleyDB 4.5.x
(will backport to 2.5)
-rw-r--r--Doc/lib/libbsddb.tex2
-rw-r--r--Lib/bsddb/dbobj.py5
-rw-r--r--Lib/bsddb/test/test_1413192.py2
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_bsddb.c8
-rw-r--r--setup.py6
6 files changed, 18 insertions, 7 deletions
diff --git a/Doc/lib/libbsddb.tex b/Doc/lib/libbsddb.tex
index 85ea824..e9d7e21 100644
--- a/Doc/lib/libbsddb.tex
+++ b/Doc/lib/libbsddb.tex
@@ -16,7 +16,7 @@ serialize them somehow, typically using \function{marshal.dumps()} or
\function{pickle.dumps()}.
The \module{bsddb} module requires a Berkeley DB library version from
-3.3 thru 4.4.
+3.3 thru 4.5.
\begin{seealso}
\seeurl{http://pybsddb.sourceforge.net/}
diff --git a/Lib/bsddb/dbobj.py b/Lib/bsddb/dbobj.py
index 73a3010..b74ee72 100644
--- a/Lib/bsddb/dbobj.py
+++ b/Lib/bsddb/dbobj.py
@@ -55,8 +55,9 @@ class DBEnv:
return apply(self._cobj.set_lg_max, args, kwargs)
def set_lk_detect(self, *args, **kwargs):
return apply(self._cobj.set_lk_detect, args, kwargs)
- def set_lk_max(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max, args, kwargs)
+ if db.version() < (4,5):
+ def set_lk_max(self, *args, **kwargs):
+ return apply(self._cobj.set_lk_max, args, kwargs)
def set_lk_max_locks(self, *args, **kwargs):
return apply(self._cobj.set_lk_max_locks, args, kwargs)
def set_lk_max_lockers(self, *args, **kwargs):
diff --git a/Lib/bsddb/test/test_1413192.py b/Lib/bsddb/test/test_1413192.py
index 3c13536..436f407 100644
--- a/Lib/bsddb/test/test_1413192.py
+++ b/Lib/bsddb/test/test_1413192.py
@@ -14,7 +14,7 @@ except ImportError:
env_name = '.'
env = db.DBEnv()
-env.open(env_name, db.DB_CREATE | db.DB_INIT_TXN)
+env.open(env_name, db.DB_CREATE | db.DB_INIT_TXN | db.DB_INIT_MPOOL)
the_txn = env.txn_begin()
map = db.DB(env)
diff --git a/Misc/NEWS b/Misc/NEWS
index 972f1e0..f3749ab 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -322,6 +322,8 @@ Extension Modules
been defined. This prevents an interactive Python from waking up 10
times per second. Patch by Richard Boulton.
+- Added support for linking the bsddb module against BerkeleyDB 4.5.x.
+
Tests
-----
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index e6046e7..13b5b7b 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -4127,6 +4127,7 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args)
}
+#if (DBVER < 45)
static PyObject*
DBEnv_set_lk_max(DBEnvObject* self, PyObject* args)
{
@@ -4142,6 +4143,7 @@ DBEnv_set_lk_max(DBEnvObject* self, PyObject* args)
RETURN_IF_ERR();
RETURN_NONE();
}
+#endif
#if (DBVER >= 32)
@@ -5231,7 +5233,9 @@ static PyMethodDef DBEnv_methods[] = {
{"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS},
#endif
{"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS},
+#if (DBVER < 45)
{"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS},
+#endif
#if (DBVER >= 32)
{"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS},
{"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS},
@@ -5833,7 +5837,9 @@ DL_EXPORT(void) init_bsddb(void)
ADD_INT(d, DB_AFTER);
ADD_INT(d, DB_APPEND);
ADD_INT(d, DB_BEFORE);
+#if (DBVER < 45)
ADD_INT(d, DB_CACHED_COUNTS);
+#endif
#if (DBVER >= 41)
_addIntToDict(d, "DB_CHECKPOINT", 0);
#else
@@ -5868,7 +5874,9 @@ DL_EXPORT(void) init_bsddb(void)
ADD_INT(d, DB_POSITION);
ADD_INT(d, DB_PREV);
ADD_INT(d, DB_PREV_NODUP);
+#if (DBVER < 45)
ADD_INT(d, DB_RECORDCOUNT);
+#endif
ADD_INT(d, DB_SET);
ADD_INT(d, DB_SET_RANGE);
ADD_INT(d, DB_SET_RECNO);
diff --git a/setup.py b/setup.py
index bf649fe..c1d5f00 100644
--- a/setup.py
+++ b/setup.py
@@ -606,7 +606,7 @@ class PyBuildExt(build_ext):
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (4, 4)
+ max_db_ver = (4, 5)
min_db_ver = (3, 3)
db_setup_debug = False # verbose debug prints from this script?
@@ -623,7 +623,7 @@ class PyBuildExt(build_ext):
'/sw/include/db3',
]
# 4.x minor number specific paths
- for x in (0,1,2,3,4):
+ for x in (0,1,2,3,4,5):
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)
@@ -631,7 +631,7 @@ class PyBuildExt(build_ext):
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):
+ for x in (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)