Skip to content

Commit 4bcc431

Browse files
author
gregory.p.smith
committed
Support linking of the bsddb module against BerkeleyDB 4.5.x
(will backport to 2.5) git-svn-id: http://svn.python.org/projects/python/trunk@53252 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent e070633 commit 4bcc431

6 files changed

Lines changed: 18 additions & 7 deletions

File tree

Doc/lib/libbsddb.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ \section{\module{bsddb} ---
1616
\function{pickle.dumps()}.
1717

1818
The \module{bsddb} module requires a Berkeley DB library version from
19-
3.3 thru 4.4.
19+
3.3 thru 4.5.
2020

2121
\begin{seealso}
2222
\seeurl{http://pybsddb.sourceforge.net/}

Lib/bsddb/dbobj.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ def set_lg_max(self, *args, **kwargs):
5555
return apply(self._cobj.set_lg_max, args, kwargs)
5656
def set_lk_detect(self, *args, **kwargs):
5757
return apply(self._cobj.set_lk_detect, args, kwargs)
58-
def set_lk_max(self, *args, **kwargs):
59-
return apply(self._cobj.set_lk_max, args, kwargs)
58+
if db.version() < (4,5):
59+
def set_lk_max(self, *args, **kwargs):
60+
return apply(self._cobj.set_lk_max, args, kwargs)
6061
def set_lk_max_locks(self, *args, **kwargs):
6162
return apply(self._cobj.set_lk_max_locks, args, kwargs)
6263
def set_lk_max_lockers(self, *args, **kwargs):

Lib/bsddb/test/test_1413192.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
env_name = '.'
1515

1616
env = db.DBEnv()
17-
env.open(env_name, db.DB_CREATE | db.DB_INIT_TXN)
17+
env.open(env_name, db.DB_CREATE | db.DB_INIT_TXN | db.DB_INIT_MPOOL)
1818
the_txn = env.txn_begin()
1919

2020
map = db.DB(env)

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ Extension Modules
322322
been defined. This prevents an interactive Python from waking up 10
323323
times per second. Patch by Richard Boulton.
324324

325+
- Added support for linking the bsddb module against BerkeleyDB 4.5.x.
326+
325327

326328
Tests
327329
-----

Modules/_bsddb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4127,6 +4127,7 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args)
41274127
}
41284128

41294129

4130+
#if (DBVER < 45)
41304131
static PyObject*
41314132
DBEnv_set_lk_max(DBEnvObject* self, PyObject* args)
41324133
{
@@ -4142,6 +4143,7 @@ DBEnv_set_lk_max(DBEnvObject* self, PyObject* args)
41424143
RETURN_IF_ERR();
41434144
RETURN_NONE();
41444145
}
4146+
#endif
41454147

41464148

41474149
#if (DBVER >= 32)
@@ -5231,7 +5233,9 @@ static PyMethodDef DBEnv_methods[] = {
52315233
{"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS},
52325234
#endif
52335235
{"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS},
5236+
#if (DBVER < 45)
52345237
{"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS},
5238+
#endif
52355239
#if (DBVER >= 32)
52365240
{"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS},
52375241
{"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS},
@@ -5833,7 +5837,9 @@ DL_EXPORT(void) init_bsddb(void)
58335837
ADD_INT(d, DB_AFTER);
58345838
ADD_INT(d, DB_APPEND);
58355839
ADD_INT(d, DB_BEFORE);
5840+
#if (DBVER < 45)
58365841
ADD_INT(d, DB_CACHED_COUNTS);
5842+
#endif
58375843
#if (DBVER >= 41)
58385844
_addIntToDict(d, "DB_CHECKPOINT", 0);
58395845
#else
@@ -5868,7 +5874,9 @@ DL_EXPORT(void) init_bsddb(void)
58685874
ADD_INT(d, DB_POSITION);
58695875
ADD_INT(d, DB_PREV);
58705876
ADD_INT(d, DB_PREV_NODUP);
5877+
#if (DBVER < 45)
58715878
ADD_INT(d, DB_RECORDCOUNT);
5879+
#endif
58725880
ADD_INT(d, DB_SET);
58735881
ADD_INT(d, DB_SET_RANGE);
58745882
ADD_INT(d, DB_SET_RECNO);

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def detect_modules(self):
606606
# a release. Most open source OSes come with one or more
607607
# versions of BerkeleyDB already installed.
608608

609-
max_db_ver = (4, 4)
609+
max_db_ver = (4, 5)
610610
min_db_ver = (3, 3)
611611
db_setup_debug = False # verbose debug prints from this script?
612612

@@ -623,15 +623,15 @@ def detect_modules(self):
623623
'/sw/include/db3',
624624
]
625625
# 4.x minor number specific paths
626-
for x in (0,1,2,3,4):
626+
for x in (0,1,2,3,4,5):
627627
db_inc_paths.append('/usr/include/db4%d' % x)
628628
db_inc_paths.append('/usr/include/db4.%d' % x)
629629
db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
630630
db_inc_paths.append('/usr/local/include/db4%d' % x)
631631
db_inc_paths.append('/pkg/db-4.%d/include' % x)
632632
db_inc_paths.append('/opt/db-4.%d/include' % x)
633633
# 3.x minor number specific paths
634-
for x in (2,3):
634+
for x in (3,):
635635
db_inc_paths.append('/usr/include/db3%d' % x)
636636
db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
637637
db_inc_paths.append('/usr/local/include/db3%d' % x)

0 commit comments

Comments
 (0)