Support linking of the bsddb module against BerkeleyDB 4.5.x

(will backport to 2.5)
This commit is contained in:
Gregory P. Smith 2007-01-05 01:59:42 +00:00
parent 7b7c9d4208
commit 8b96a35d14
6 changed files with 18 additions and 7 deletions

View File

@ -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/}

View File

@ -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):

View File

@ -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)

View File

@ -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
-----

View File

@ -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);

View File

@ -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)