Kaydet (Commit) 1a050f5f authored tarafından Gregory P. Smith's avatar Gregory P. Smith

support linking the _bsddb extension module against BerkeleyDB 4.5

[backport of r53252]
üst bea1c701
...@@ -16,7 +16,7 @@ serialize them somehow, typically using \function{marshal.dumps()} or ...@@ -16,7 +16,7 @@ serialize them somehow, typically using \function{marshal.dumps()} or
\function{pickle.dumps()}. \function{pickle.dumps()}.
The \module{bsddb} module requires a Berkeley DB library version from The \module{bsddb} module requires a Berkeley DB library version from
3.3 thru 4.4. 3.3 thru 4.5.
\begin{seealso} \begin{seealso}
\seeurl{http://pybsddb.sourceforge.net/} \seeurl{http://pybsddb.sourceforge.net/}
......
...@@ -55,8 +55,9 @@ class DBEnv: ...@@ -55,8 +55,9 @@ class DBEnv:
return apply(self._cobj.set_lg_max, args, kwargs) return apply(self._cobj.set_lg_max, args, kwargs)
def set_lk_detect(self, *args, **kwargs): def set_lk_detect(self, *args, **kwargs):
return apply(self._cobj.set_lk_detect, args, kwargs) return apply(self._cobj.set_lk_detect, args, kwargs)
def set_lk_max(self, *args, **kwargs): if db.version() < (4,5):
return apply(self._cobj.set_lk_max, args, kwargs) def set_lk_max(self, *args, **kwargs):
return apply(self._cobj.set_lk_max, args, kwargs)
def set_lk_max_locks(self, *args, **kwargs): def set_lk_max_locks(self, *args, **kwargs):
return apply(self._cobj.set_lk_max_locks, args, kwargs) return apply(self._cobj.set_lk_max_locks, args, kwargs)
def set_lk_max_lockers(self, *args, **kwargs): def set_lk_max_lockers(self, *args, **kwargs):
......
...@@ -14,7 +14,7 @@ except ImportError: ...@@ -14,7 +14,7 @@ except ImportError:
env_name = '.' env_name = '.'
env = db.DBEnv() 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() the_txn = env.txn_begin()
map = db.DB(env) map = db.DB(env)
......
...@@ -124,6 +124,8 @@ Extension Modules ...@@ -124,6 +124,8 @@ Extension Modules
- Make regex engine raise MemoryError if allocating memory fails. - Make regex engine raise MemoryError if allocating memory fails.
- Added support for linking the bsddb module against BerkeleyDB 4.5.x.
Library Library
------- -------
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
#error "eek! DBVER can't handle minor versions > 9" #error "eek! DBVER can't handle minor versions > 9"
#endif #endif
#define PY_BSDDB_VERSION "4.4.5.1" #define PY_BSDDB_VERSION "4.4.5.2"
static char *rcs_id = "$Id$"; static char *rcs_id = "$Id$";
...@@ -4127,6 +4127,7 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args) ...@@ -4127,6 +4127,7 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args)
} }
#if (DBVER < 45)
static PyObject* static PyObject*
DBEnv_set_lk_max(DBEnvObject* self, PyObject* args) DBEnv_set_lk_max(DBEnvObject* self, PyObject* args)
{ {
...@@ -4142,6 +4143,7 @@ DBEnv_set_lk_max(DBEnvObject* self, PyObject* args) ...@@ -4142,6 +4143,7 @@ DBEnv_set_lk_max(DBEnvObject* self, PyObject* args)
RETURN_IF_ERR(); RETURN_IF_ERR();
RETURN_NONE(); RETURN_NONE();
} }
#endif
#if (DBVER >= 32) #if (DBVER >= 32)
...@@ -5231,7 +5233,9 @@ static PyMethodDef DBEnv_methods[] = { ...@@ -5231,7 +5233,9 @@ static PyMethodDef DBEnv_methods[] = {
{"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS}, {"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS},
#endif #endif
{"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS}, {"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS},
#if (DBVER < 45)
{"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS}, {"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS},
#endif
#if (DBVER >= 32) #if (DBVER >= 32)
{"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS}, {"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS},
{"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS}, {"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS},
...@@ -5833,7 +5837,9 @@ DL_EXPORT(void) init_bsddb(void) ...@@ -5833,7 +5837,9 @@ DL_EXPORT(void) init_bsddb(void)
ADD_INT(d, DB_AFTER); ADD_INT(d, DB_AFTER);
ADD_INT(d, DB_APPEND); ADD_INT(d, DB_APPEND);
ADD_INT(d, DB_BEFORE); ADD_INT(d, DB_BEFORE);
#if (DBVER < 45)
ADD_INT(d, DB_CACHED_COUNTS); ADD_INT(d, DB_CACHED_COUNTS);
#endif
#if (DBVER >= 41) #if (DBVER >= 41)
_addIntToDict(d, "DB_CHECKPOINT", 0); _addIntToDict(d, "DB_CHECKPOINT", 0);
#else #else
...@@ -5868,7 +5874,9 @@ DL_EXPORT(void) init_bsddb(void) ...@@ -5868,7 +5874,9 @@ DL_EXPORT(void) init_bsddb(void)
ADD_INT(d, DB_POSITION); ADD_INT(d, DB_POSITION);
ADD_INT(d, DB_PREV); ADD_INT(d, DB_PREV);
ADD_INT(d, DB_PREV_NODUP); ADD_INT(d, DB_PREV_NODUP);
#if (DBVER < 45)
ADD_INT(d, DB_RECORDCOUNT); ADD_INT(d, DB_RECORDCOUNT);
#endif
ADD_INT(d, DB_SET); ADD_INT(d, DB_SET);
ADD_INT(d, DB_SET_RANGE); ADD_INT(d, DB_SET_RANGE);
ADD_INT(d, DB_SET_RECNO); ADD_INT(d, DB_SET_RECNO);
......
...@@ -606,7 +606,7 @@ class PyBuildExt(build_ext): ...@@ -606,7 +606,7 @@ class PyBuildExt(build_ext):
# a release. Most open source OSes come with one or more # a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed. # versions of BerkeleyDB already installed.
max_db_ver = (4, 4) max_db_ver = (4, 5)
min_db_ver = (3, 3) min_db_ver = (3, 3)
db_setup_debug = False # verbose debug prints from this script? db_setup_debug = False # verbose debug prints from this script?
...@@ -623,7 +623,7 @@ class PyBuildExt(build_ext): ...@@ -623,7 +623,7 @@ class PyBuildExt(build_ext):
'/sw/include/db3', '/sw/include/db3',
] ]
# 4.x minor number specific paths # 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/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/BerkeleyDB.4.%d/include' % x)
...@@ -631,7 +631,7 @@ class PyBuildExt(build_ext): ...@@ -631,7 +631,7 @@ class PyBuildExt(build_ext):
db_inc_paths.append('/pkg/db-4.%d/include' % x) db_inc_paths.append('/pkg/db-4.%d/include' % x)
db_inc_paths.append('/opt/db-4.%d/include' % x) db_inc_paths.append('/opt/db-4.%d/include' % x)
# 3.x minor number specific paths # 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/include/db3%d' % x)
db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % 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('/usr/local/include/db3%d' % x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment