diff options
author | Jackie Huang <jackie.huang@windriver.com> | 2012-08-04 21:14:08 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-06 15:18:47 +0100 |
commit | 77625e728b3199b659bda622446687dfb39b7926 (patch) | |
tree | 40faae08870e75be7b8df5430d3bf3aae1b0a827 /meta/recipes-devtools/python | |
parent | 941d107053b82cc617f5042a57707617728e3ed6 (diff) | |
download | poky-77625e728b3199b659bda622446687dfb39b7926.tar.gz |
python: Fix to support the python module _bsddb built with db 5.3
_bsddb module in python 2.7 could be built only with db version
between 4.1 and 4.7. A patch was added to avoid build warning
about this for [YOCTO #1937] but not actually fixed it.
This patch enable _bsddb module be built with db 5.3, and remove
--disable-statistics from the DB5_CONFIG to fix segmentation fault
when using _bsddb module in python.
[YOCTO #2749]
(From OE-Core rev: 11267f8a1ccf65142988b095351a84b0fa0fcbcf)
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python')
4 files changed, 1595 insertions, 25 deletions
diff --git a/meta/recipes-devtools/python/python/avoid_warning_about_bsddb.patch b/meta/recipes-devtools/python/python/avoid_warning_about_bsddb.patch deleted file mode 100644 index 4968744cb6..0000000000 --- a/meta/recipes-devtools/python/python/avoid_warning_about_bsddb.patch +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | _bsddb module can be built only with db version between 4.1 and 4.7. | ||
2 | Avoid a warning by not adding this module to missing variable. | ||
3 | |||
4 | Upstream-Status: Inappropriate [distribution] | ||
5 | |||
6 | Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> | ||
7 | |||
8 | |||
9 | Index: Python-2.7.2/setup.py | ||
10 | =================================================================== | ||
11 | --- Python-2.7.2.orig/setup.py 2012-04-05 23:16:49.268139840 +0300 | ||
12 | +++ Python-2.7.2/setup.py 2012-04-05 23:17:30.912138622 +0300 | ||
13 | @@ -1024,7 +1024,9 @@ | ||
14 | db_incs = None | ||
15 | dblibs = [] | ||
16 | dblib_dir = None | ||
17 | - missing.append('_bsddb') | ||
18 | + # We need db version between 4.1 and 4.7 | ||
19 | + # Avoid this warning | ||
20 | + #missing.append('_bsddb') | ||
21 | |||
22 | # The sqlite interface | ||
23 | sqlite_setup_debug = False # verbose debug prints from this script? | ||
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch new file mode 100644 index 0000000000..469cbb3ef9 --- /dev/null +++ b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch | |||
@@ -0,0 +1,1570 @@ | |||
1 | Fix to support db 5.3 for bsddb module in python 2.7.2 | ||
2 | |||
3 | This patch is made from the db5.1.diff in | ||
4 | http://archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.3-0ubuntu3.diff.gz | ||
5 | |||
6 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
7 | --- | ||
8 | Lib/bsddb/__init__.py | 2 +- | ||
9 | Lib/bsddb/test/test_all.py | 5 +- | ||
10 | Lib/bsddb/test/test_dbenv.py | 29 +++- | ||
11 | Modules/_bsddb.c | 439 +++++++++++++++++++++++------------------- | ||
12 | Modules/bsddb.h | 20 +- | ||
13 | setup.py | 25 +++- | ||
14 | 6 files changed, 307 insertions(+), 213 deletions(-) | ||
15 | |||
16 | diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py | ||
17 | index ed4deea..1b1c388 100644 | ||
18 | --- a/Lib/bsddb/__init__.py | ||
19 | +++ b/Lib/bsddb/__init__.py | ||
20 | @@ -33,7 +33,7 @@ | ||
21 | #---------------------------------------------------------------------- | ||
22 | |||
23 | |||
24 | -"""Support for Berkeley DB 4.1 through 4.8 with a simple interface. | ||
25 | +"""Support for Berkeley DB 4.2 through 5.3 with a simple interface. | ||
26 | |||
27 | For the full featured object oriented interface use the bsddb.db module | ||
28 | instead. It mirrors the Oracle Berkeley DB C API. | ||
29 | diff --git a/Lib/bsddb/test/test_all.py b/Lib/bsddb/test/test_all.py | ||
30 | index e9fe618..6a25f4a 100644 | ||
31 | --- a/Lib/bsddb/test/test_all.py | ||
32 | +++ b/Lib/bsddb/test/test_all.py | ||
33 | @@ -484,6 +484,8 @@ def print_versions(): | ||
34 | print '-=' * 38 | ||
35 | print db.DB_VERSION_STRING | ||
36 | print 'bsddb.db.version(): %s' % (db.version(), ) | ||
37 | + if db.version() >= (5, 0) : | ||
38 | + print 'bsddb.db.full_version(): %s' %repr(db.full_version()) | ||
39 | print 'bsddb.db.__version__: %s' % db.__version__ | ||
40 | print 'bsddb.db.cvsid: %s' % db.cvsid | ||
41 | |||
42 | @@ -528,7 +530,8 @@ def get_new_database_path() : | ||
43 | |||
44 | # This path can be overriden via "set_test_path_prefix()". | ||
45 | import os, os.path | ||
46 | -get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB") | ||
47 | +get_new_path.prefix=os.path.join(os.environ.get("TMPDIR", | ||
48 | + os.path.join(os.sep,"tmp")), "z-Berkeley_DB") | ||
49 | get_new_path.num=0 | ||
50 | |||
51 | def get_test_path_prefix() : | ||
52 | diff --git a/Lib/bsddb/test/test_dbenv.py b/Lib/bsddb/test/test_dbenv.py | ||
53 | index 37281df..6ac1e54 100644 | ||
54 | --- a/Lib/bsddb/test/test_dbenv.py | ||
55 | +++ b/Lib/bsddb/test/test_dbenv.py | ||
56 | @@ -25,12 +25,31 @@ class DBEnv(unittest.TestCase): | ||
57 | test_support.rmtree(self.homeDir) | ||
58 | |||
59 | class DBEnv_general(DBEnv) : | ||
60 | + def test_get_open_flags(self) : | ||
61 | + flags = db.DB_CREATE | db.DB_INIT_MPOOL | ||
62 | + self.env.open(self.homeDir, flags) | ||
63 | + self.assertEqual(flags, self.env.get_open_flags()) | ||
64 | + | ||
65 | + def test_get_open_flags2(self) : | ||
66 | + flags = db.DB_CREATE | db.DB_INIT_MPOOL | \ | ||
67 | + db.DB_INIT_LOCK | db.DB_THREAD | ||
68 | + self.env.open(self.homeDir, flags) | ||
69 | + self.assertEqual(flags, self.env.get_open_flags()) | ||
70 | + | ||
71 | if db.version() >= (4, 7) : | ||
72 | def test_lk_partitions(self) : | ||
73 | for i in [10, 20, 40] : | ||
74 | self.env.set_lk_partitions(i) | ||
75 | self.assertEqual(i, self.env.get_lk_partitions()) | ||
76 | |||
77 | + def test_getset_intermediate_dir_mode(self) : | ||
78 | + self.assertEqual(None, self.env.get_intermediate_dir_mode()) | ||
79 | + for mode in ["rwx------", "rw-rw-rw-", "rw-r--r--"] : | ||
80 | + self.env.set_intermediate_dir_mode(mode) | ||
81 | + self.assertEqual(mode, self.env.get_intermediate_dir_mode()) | ||
82 | + self.assertRaises(db.DBInvalidArgError, | ||
83 | + self.env.set_intermediate_dir_mode, "abcde") | ||
84 | + | ||
85 | if db.version() >= (4, 6) : | ||
86 | def test_thread(self) : | ||
87 | for i in [16, 100, 1000] : | ||
88 | @@ -115,7 +134,7 @@ class DBEnv_general(DBEnv) : | ||
89 | self.assertEqual(i, self.env.get_lk_max_lockers()) | ||
90 | |||
91 | def test_lg_regionmax(self) : | ||
92 | - for i in [128, 256, 1024] : | ||
93 | + for i in [128, 256, 1000] : | ||
94 | i = i*1024*1024 | ||
95 | self.env.set_lg_regionmax(i) | ||
96 | j = self.env.get_lg_regionmax() | ||
97 | @@ -172,8 +191,12 @@ class DBEnv_general(DBEnv) : | ||
98 | self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) | ||
99 | cachesize = (0, 2*1024*1024, 1) | ||
100 | self.assertRaises(db.DBInvalidArgError, | ||
101 | - self.env.set_cachesize, *cachesize) | ||
102 | - self.assertEqual(cachesize2, self.env.get_cachesize()) | ||
103 | + self.env.set_cachesize, *cachesize) | ||
104 | + cachesize3 = self.env.get_cachesize() | ||
105 | + self.assertEqual(cachesize2[0], cachesize3[0]) | ||
106 | + self.assertEqual(cachesize2[2], cachesize3[2]) | ||
107 | + # In Berkeley DB 5.3, the cachesize can change when opening the Env | ||
108 | + self.assertTrue(cachesize2[1] <= cachesize3[1]) | ||
109 | |||
110 | def test_set_cachesize_dbenv_db(self) : | ||
111 | # You can not configure the cachesize using | ||
112 | diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c | ||
113 | index d2d12ff..e98e4bc 100644 | ||
114 | --- a/Modules/_bsddb.c | ||
115 | +++ b/Modules/_bsddb.c | ||
116 | @@ -187,8 +187,10 @@ static PyObject* DBOldVersionError; /* DB_OLD_VERSION */ | ||
117 | static PyObject* DBRunRecoveryError; /* DB_RUNRECOVERY */ | ||
118 | static PyObject* DBVerifyBadError; /* DB_VERIFY_BAD */ | ||
119 | static PyObject* DBNoServerError; /* DB_NOSERVER */ | ||
120 | +#if (DBVER < 52) | ||
121 | static PyObject* DBNoServerHomeError; /* DB_NOSERVER_HOME */ | ||
122 | static PyObject* DBNoServerIDError; /* DB_NOSERVER_ID */ | ||
123 | +#endif | ||
124 | static PyObject* DBPageNotFoundError; /* DB_PAGE_NOTFOUND */ | ||
125 | static PyObject* DBSecondaryBadError; /* DB_SECONDARY_BAD */ | ||
126 | |||
127 | @@ -202,9 +204,7 @@ static PyObject* DBFileExistsError; /* EEXIST */ | ||
128 | static PyObject* DBNoSuchFileError; /* ENOENT */ | ||
129 | static PyObject* DBPermissionsError; /* EPERM */ | ||
130 | |||
131 | -#if (DBVER >= 42) | ||
132 | static PyObject* DBRepHandleDeadError; /* DB_REP_HANDLE_DEAD */ | ||
133 | -#endif | ||
134 | #if (DBVER >= 44) | ||
135 | static PyObject* DBRepLockoutError; /* DB_REP_LOCKOUT */ | ||
136 | #endif | ||
137 | @@ -696,8 +696,10 @@ static int makeDBError(int err) | ||
138 | case DB_RUNRECOVERY: errObj = DBRunRecoveryError; break; | ||
139 | case DB_VERIFY_BAD: errObj = DBVerifyBadError; break; | ||
140 | case DB_NOSERVER: errObj = DBNoServerError; break; | ||
141 | +#if (DBVER < 52) | ||
142 | case DB_NOSERVER_HOME: errObj = DBNoServerHomeError; break; | ||
143 | case DB_NOSERVER_ID: errObj = DBNoServerIDError; break; | ||
144 | +#endif | ||
145 | case DB_PAGE_NOTFOUND: errObj = DBPageNotFoundError; break; | ||
146 | case DB_SECONDARY_BAD: errObj = DBSecondaryBadError; break; | ||
147 | case DB_BUFFER_SMALL: errObj = DBNoMemoryError; break; | ||
148 | @@ -715,9 +717,7 @@ static int makeDBError(int err) | ||
149 | case ENOENT: errObj = DBNoSuchFileError; break; | ||
150 | case EPERM : errObj = DBPermissionsError; break; | ||
151 | |||
152 | -#if (DBVER >= 42) | ||
153 | case DB_REP_HANDLE_DEAD : errObj = DBRepHandleDeadError; break; | ||
154 | -#endif | ||
155 | #if (DBVER >= 44) | ||
156 | case DB_REP_LOCKOUT : errObj = DBRepLockoutError; break; | ||
157 | #endif | ||
158 | @@ -2132,7 +2132,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs) | ||
159 | MYDB_BEGIN_ALLOW_THREADS; | ||
160 | err = self->db->get(self->db, txn, &key, &data, flags); | ||
161 | MYDB_END_ALLOW_THREADS; | ||
162 | - if (err == DB_BUFFER_SMALL) { | ||
163 | + if ((err == DB_BUFFER_SMALL) || (err == 0)) { | ||
164 | retval = NUMBER_FromLong((long)data.size); | ||
165 | err = 0; | ||
166 | } | ||
167 | @@ -2385,9 +2385,7 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs) | ||
168 | return NULL; | ||
169 | } | ||
170 | |||
171 | -#if (DBVER >= 42) | ||
172 | self->db->get_flags(self->db, &self->setflags); | ||
173 | -#endif | ||
174 | |||
175 | self->flags = flags; | ||
176 | |||
177 | @@ -2539,6 +2537,37 @@ DB_get_priority(DBObject* self) | ||
178 | #endif | ||
179 | |||
180 | static PyObject* | ||
181 | +DB_get_dbname(DBObject* self) | ||
182 | +{ | ||
183 | + int err; | ||
184 | + const char *filename, *dbname; | ||
185 | + | ||
186 | + CHECK_DB_NOT_CLOSED(self); | ||
187 | + | ||
188 | + MYDB_BEGIN_ALLOW_THREADS; | ||
189 | + err = self->db->get_dbname(self->db, &filename, &dbname); | ||
190 | + MYDB_END_ALLOW_THREADS; | ||
191 | + RETURN_IF_ERR(); | ||
192 | + /* If "dbname==NULL", it is correctly converted to "None" */ | ||
193 | + return Py_BuildValue("(ss)", filename, dbname); | ||
194 | +} | ||
195 | + | ||
196 | +static PyObject* | ||
197 | +DB_get_open_flags(DBObject* self) | ||
198 | +{ | ||
199 | + int err; | ||
200 | + unsigned int flags; | ||
201 | + | ||
202 | + CHECK_DB_NOT_CLOSED(self); | ||
203 | + | ||
204 | + MYDB_BEGIN_ALLOW_THREADS; | ||
205 | + err = self->db->get_open_flags(self->db, &flags); | ||
206 | + MYDB_END_ALLOW_THREADS; | ||
207 | + RETURN_IF_ERR(); | ||
208 | + return NUMBER_FromLong(flags); | ||
209 | +} | ||
210 | + | ||
211 | +static PyObject* | ||
212 | DB_set_q_extentsize(DBObject* self, PyObject* args) | ||
213 | { | ||
214 | int err; | ||
215 | @@ -2555,7 +2584,6 @@ DB_set_q_extentsize(DBObject* self, PyObject* args) | ||
216 | RETURN_NONE(); | ||
217 | } | ||
218 | |||
219 | -#if (DBVER >= 42) | ||
220 | static PyObject* | ||
221 | DB_get_q_extentsize(DBObject* self) | ||
222 | { | ||
223 | @@ -2570,7 +2598,6 @@ DB_get_q_extentsize(DBObject* self) | ||
224 | RETURN_IF_ERR(); | ||
225 | return NUMBER_FromLong(extentsize); | ||
226 | } | ||
227 | -#endif | ||
228 | |||
229 | static PyObject* | ||
230 | DB_set_bt_minkey(DBObject* self, PyObject* args) | ||
231 | @@ -2588,7 +2615,6 @@ DB_set_bt_minkey(DBObject* self, PyObject* args) | ||
232 | RETURN_NONE(); | ||
233 | } | ||
234 | |||
235 | -#if (DBVER >= 42) | ||
236 | static PyObject* | ||
237 | DB_get_bt_minkey(DBObject* self) | ||
238 | { | ||
239 | @@ -2603,7 +2629,6 @@ DB_get_bt_minkey(DBObject* self) | ||
240 | RETURN_IF_ERR(); | ||
241 | return NUMBER_FromLong(bt_minkey); | ||
242 | } | ||
243 | -#endif | ||
244 | |||
245 | static int | ||
246 | _default_cmp(const DBT *leftKey, | ||
247 | @@ -2759,7 +2784,6 @@ DB_set_cachesize(DBObject* self, PyObject* args) | ||
248 | RETURN_NONE(); | ||
249 | } | ||
250 | |||
251 | -#if (DBVER >= 42) | ||
252 | static PyObject* | ||
253 | DB_get_cachesize(DBObject* self) | ||
254 | { | ||
255 | @@ -2777,7 +2801,6 @@ DB_get_cachesize(DBObject* self) | ||
256 | |||
257 | return Py_BuildValue("(iii)", gbytes, bytes, ncache); | ||
258 | } | ||
259 | -#endif | ||
260 | |||
261 | static PyObject* | ||
262 | DB_set_flags(DBObject* self, PyObject* args) | ||
263 | @@ -2797,7 +2820,6 @@ DB_set_flags(DBObject* self, PyObject* args) | ||
264 | RETURN_NONE(); | ||
265 | } | ||
266 | |||
267 | -#if (DBVER >= 42) | ||
268 | static PyObject* | ||
269 | DB_get_flags(DBObject* self) | ||
270 | { | ||
271 | @@ -2812,6 +2834,35 @@ DB_get_flags(DBObject* self) | ||
272 | RETURN_IF_ERR(); | ||
273 | return NUMBER_FromLong(flags); | ||
274 | } | ||
275 | + | ||
276 | +#if (DBVER >= 43) | ||
277 | +static PyObject* | ||
278 | +DB_get_transactional(DBObject* self) | ||
279 | +{ | ||
280 | + int err; | ||
281 | + | ||
282 | + CHECK_DB_NOT_CLOSED(self); | ||
283 | + | ||
284 | + MYDB_BEGIN_ALLOW_THREADS; | ||
285 | + err = self->db->get_transactional(self->db); | ||
286 | + MYDB_END_ALLOW_THREADS; | ||
287 | + | ||
288 | + if(err == 0) { | ||
289 | + Py_INCREF(Py_False); | ||
290 | + return Py_False; | ||
291 | + } else if(err == 1) { | ||
292 | + Py_INCREF(Py_True); | ||
293 | + return Py_True; | ||
294 | + } | ||
295 | + | ||
296 | + /* | ||
297 | + ** If we reach there, there was an error. The | ||
298 | + ** "return" should be unreachable. | ||
299 | + */ | ||
300 | + RETURN_IF_ERR(); | ||
301 | + assert(0); /* This coude SHOULD be unreachable */ | ||
302 | + return NULL; | ||
303 | +} | ||
304 | #endif | ||
305 | |||
306 | static PyObject* | ||
307 | @@ -2830,7 +2881,6 @@ DB_set_h_ffactor(DBObject* self, PyObject* args) | ||
308 | RETURN_NONE(); | ||
309 | } | ||
310 | |||
311 | -#if (DBVER >= 42) | ||
312 | static PyObject* | ||
313 | DB_get_h_ffactor(DBObject* self) | ||
314 | { | ||
315 | @@ -2845,7 +2895,6 @@ DB_get_h_ffactor(DBObject* self) | ||
316 | RETURN_IF_ERR(); | ||
317 | return NUMBER_FromLong(ffactor); | ||
318 | } | ||
319 | -#endif | ||
320 | |||
321 | static PyObject* | ||
322 | DB_set_h_nelem(DBObject* self, PyObject* args) | ||
323 | @@ -2863,7 +2912,6 @@ DB_set_h_nelem(DBObject* self, PyObject* args) | ||
324 | RETURN_NONE(); | ||
325 | } | ||
326 | |||
327 | -#if (DBVER >= 42) | ||
328 | static PyObject* | ||
329 | DB_get_h_nelem(DBObject* self) | ||
330 | { | ||
331 | @@ -2878,7 +2926,6 @@ DB_get_h_nelem(DBObject* self) | ||
332 | RETURN_IF_ERR(); | ||
333 | return NUMBER_FromLong(nelem); | ||
334 | } | ||
335 | -#endif | ||
336 | |||
337 | static PyObject* | ||
338 | DB_set_lorder(DBObject* self, PyObject* args) | ||
339 | @@ -2896,7 +2943,6 @@ DB_set_lorder(DBObject* self, PyObject* args) | ||
340 | RETURN_NONE(); | ||
341 | } | ||
342 | |||
343 | -#if (DBVER >= 42) | ||
344 | static PyObject* | ||
345 | DB_get_lorder(DBObject* self) | ||
346 | { | ||
347 | @@ -2911,7 +2957,6 @@ DB_get_lorder(DBObject* self) | ||
348 | RETURN_IF_ERR(); | ||
349 | return NUMBER_FromLong(lorder); | ||
350 | } | ||
351 | -#endif | ||
352 | |||
353 | static PyObject* | ||
354 | DB_set_pagesize(DBObject* self, PyObject* args) | ||
355 | @@ -2929,7 +2974,6 @@ DB_set_pagesize(DBObject* self, PyObject* args) | ||
356 | RETURN_NONE(); | ||
357 | } | ||
358 | |||
359 | -#if (DBVER >= 42) | ||
360 | static PyObject* | ||
361 | DB_get_pagesize(DBObject* self) | ||
362 | { | ||
363 | @@ -2944,7 +2988,6 @@ DB_get_pagesize(DBObject* self) | ||
364 | RETURN_IF_ERR(); | ||
365 | return NUMBER_FromLong(pagesize); | ||
366 | } | ||
367 | -#endif | ||
368 | |||
369 | static PyObject* | ||
370 | DB_set_re_delim(DBObject* self, PyObject* args) | ||
371 | @@ -2967,7 +3010,6 @@ DB_set_re_delim(DBObject* self, PyObject* args) | ||
372 | RETURN_NONE(); | ||
373 | } | ||
374 | |||
375 | -#if (DBVER >= 42) | ||
376 | static PyObject* | ||
377 | DB_get_re_delim(DBObject* self) | ||
378 | { | ||
379 | @@ -2981,7 +3023,6 @@ DB_get_re_delim(DBObject* self) | ||
380 | RETURN_IF_ERR(); | ||
381 | return NUMBER_FromLong(re_delim); | ||
382 | } | ||
383 | -#endif | ||
384 | |||
385 | static PyObject* | ||
386 | DB_set_re_len(DBObject* self, PyObject* args) | ||
387 | @@ -2999,7 +3040,6 @@ DB_set_re_len(DBObject* self, PyObject* args) | ||
388 | RETURN_NONE(); | ||
389 | } | ||
390 | |||
391 | -#if (DBVER >= 42) | ||
392 | static PyObject* | ||
393 | DB_get_re_len(DBObject* self) | ||
394 | { | ||
395 | @@ -3014,7 +3054,6 @@ DB_get_re_len(DBObject* self) | ||
396 | RETURN_IF_ERR(); | ||
397 | return NUMBER_FromLong(re_len); | ||
398 | } | ||
399 | -#endif | ||
400 | |||
401 | static PyObject* | ||
402 | DB_set_re_pad(DBObject* self, PyObject* args) | ||
403 | @@ -3036,7 +3075,6 @@ DB_set_re_pad(DBObject* self, PyObject* args) | ||
404 | RETURN_NONE(); | ||
405 | } | ||
406 | |||
407 | -#if (DBVER >= 42) | ||
408 | static PyObject* | ||
409 | DB_get_re_pad(DBObject* self) | ||
410 | { | ||
411 | @@ -3050,7 +3088,6 @@ DB_get_re_pad(DBObject* self) | ||
412 | RETURN_IF_ERR(); | ||
413 | return NUMBER_FromLong(re_pad); | ||
414 | } | ||
415 | -#endif | ||
416 | |||
417 | static PyObject* | ||
418 | DB_set_re_source(DBObject* self, PyObject* args) | ||
419 | @@ -3069,7 +3106,6 @@ DB_set_re_source(DBObject* self, PyObject* args) | ||
420 | RETURN_NONE(); | ||
421 | } | ||
422 | |||
423 | -#if (DBVER >= 42) | ||
424 | static PyObject* | ||
425 | DB_get_re_source(DBObject* self) | ||
426 | { | ||
427 | @@ -3084,7 +3120,6 @@ DB_get_re_source(DBObject* self) | ||
428 | RETURN_IF_ERR(); | ||
429 | return PyBytes_FromString(source); | ||
430 | } | ||
431 | -#endif | ||
432 | |||
433 | static PyObject* | ||
434 | DB_stat(DBObject* self, PyObject* args, PyObject* kwargs) | ||
435 | @@ -3381,7 +3416,6 @@ DB_set_encrypt(DBObject* self, PyObject* args, PyObject* kwargs) | ||
436 | RETURN_NONE(); | ||
437 | } | ||
438 | |||
439 | -#if (DBVER >= 42) | ||
440 | static PyObject* | ||
441 | DB_get_encrypt_flags(DBObject* self) | ||
442 | { | ||
443 | @@ -3396,7 +3430,6 @@ DB_get_encrypt_flags(DBObject* self) | ||
444 | |||
445 | return NUMBER_FromLong(flags); | ||
446 | } | ||
447 | -#endif | ||
448 | |||
449 | |||
450 | |||
451 | @@ -4987,7 +5020,6 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs) | ||
452 | RETURN_NONE(); | ||
453 | } | ||
454 | |||
455 | -#if (DBVER >= 42) | ||
456 | static PyObject* | ||
457 | DBEnv_get_encrypt_flags(DBEnvObject* self) | ||
458 | { | ||
459 | @@ -5025,7 +5057,6 @@ DBEnv_get_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs) | ||
460 | RETURN_IF_ERR(); | ||
461 | return NUMBER_FromLong(timeout); | ||
462 | } | ||
463 | -#endif | ||
464 | |||
465 | |||
466 | static PyObject* | ||
467 | @@ -5064,7 +5095,6 @@ DBEnv_set_shm_key(DBEnvObject* self, PyObject* args) | ||
468 | RETURN_NONE(); | ||
469 | } | ||
470 | |||
471 | -#if (DBVER >= 42) | ||
472 | static PyObject* | ||
473 | DBEnv_get_shm_key(DBEnvObject* self) | ||
474 | { | ||
475 | @@ -5081,7 +5111,6 @@ DBEnv_get_shm_key(DBEnvObject* self) | ||
476 | |||
477 | return NUMBER_FromLong(shm_key); | ||
478 | } | ||
479 | -#endif | ||
480 | |||
481 | #if (DBVER >= 46) | ||
482 | static PyObject* | ||
483 | @@ -5170,7 +5199,6 @@ DBEnv_set_cachesize(DBEnvObject* self, PyObject* args) | ||
484 | RETURN_NONE(); | ||
485 | } | ||
486 | |||
487 | -#if (DBVER >= 42) | ||
488 | static PyObject* | ||
489 | DBEnv_get_cachesize(DBEnvObject* self) | ||
490 | { | ||
491 | @@ -5188,7 +5216,6 @@ DBEnv_get_cachesize(DBEnvObject* self) | ||
492 | |||
493 | return Py_BuildValue("(iii)", gbytes, bytes, ncache); | ||
494 | } | ||
495 | -#endif | ||
496 | |||
497 | |||
498 | static PyObject* | ||
499 | @@ -5208,7 +5235,6 @@ DBEnv_set_flags(DBEnvObject* self, PyObject* args) | ||
500 | RETURN_NONE(); | ||
501 | } | ||
502 | |||
503 | -#if (DBVER >= 42) | ||
504 | static PyObject* | ||
505 | DBEnv_get_flags(DBEnvObject* self) | ||
506 | { | ||
507 | @@ -5223,7 +5249,6 @@ DBEnv_get_flags(DBEnvObject* self) | ||
508 | RETURN_IF_ERR(); | ||
509 | return NUMBER_FromLong(flags); | ||
510 | } | ||
511 | -#endif | ||
512 | |||
513 | #if (DBVER >= 47) | ||
514 | static PyObject* | ||
515 | @@ -5423,7 +5448,6 @@ DBEnv_set_data_dir(DBEnvObject* self, PyObject* args) | ||
516 | RETURN_NONE(); | ||
517 | } | ||
518 | |||
519 | -#if (DBVER >= 42) | ||
520 | static PyObject* | ||
521 | DBEnv_get_data_dirs(DBEnvObject* self) | ||
522 | { | ||
523 | @@ -5463,7 +5487,6 @@ DBEnv_get_data_dirs(DBEnvObject* self) | ||
524 | } | ||
525 | return tuple; | ||
526 | } | ||
527 | -#endif | ||
528 | |||
529 | #if (DBVER >= 44) | ||
530 | static PyObject* | ||
531 | @@ -5513,7 +5536,6 @@ DBEnv_set_lg_bsize(DBEnvObject* self, PyObject* args) | ||
532 | RETURN_NONE(); | ||
533 | } | ||
534 | |||
535 | -#if (DBVER >= 42) | ||
536 | static PyObject* | ||
537 | DBEnv_get_lg_bsize(DBEnvObject* self) | ||
538 | { | ||
539 | @@ -5528,7 +5550,6 @@ DBEnv_get_lg_bsize(DBEnvObject* self) | ||
540 | RETURN_IF_ERR(); | ||
541 | return NUMBER_FromLong(lg_bsize); | ||
542 | } | ||
543 | -#endif | ||
544 | |||
545 | static PyObject* | ||
546 | DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args) | ||
547 | @@ -5547,7 +5568,6 @@ DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args) | ||
548 | RETURN_NONE(); | ||
549 | } | ||
550 | |||
551 | -#if (DBVER >= 42) | ||
552 | static PyObject* | ||
553 | DBEnv_get_lg_dir(DBEnvObject* self) | ||
554 | { | ||
555 | @@ -5562,7 +5582,6 @@ DBEnv_get_lg_dir(DBEnvObject* self) | ||
556 | RETURN_IF_ERR(); | ||
557 | return PyBytes_FromString(dirp); | ||
558 | } | ||
559 | -#endif | ||
560 | |||
561 | static PyObject* | ||
562 | DBEnv_set_lg_max(DBEnvObject* self, PyObject* args) | ||
563 | @@ -5580,7 +5599,6 @@ DBEnv_set_lg_max(DBEnvObject* self, PyObject* args) | ||
564 | RETURN_NONE(); | ||
565 | } | ||
566 | |||
567 | -#if (DBVER >= 42) | ||
568 | static PyObject* | ||
569 | DBEnv_get_lg_max(DBEnvObject* self) | ||
570 | { | ||
571 | @@ -5595,8 +5613,6 @@ DBEnv_get_lg_max(DBEnvObject* self) | ||
572 | RETURN_IF_ERR(); | ||
573 | return NUMBER_FromLong(lg_max); | ||
574 | } | ||
575 | -#endif | ||
576 | - | ||
577 | |||
578 | static PyObject* | ||
579 | DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args) | ||
580 | @@ -5614,7 +5630,6 @@ DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args) | ||
581 | RETURN_NONE(); | ||
582 | } | ||
583 | |||
584 | -#if (DBVER >= 42) | ||
585 | static PyObject* | ||
586 | DBEnv_get_lg_regionmax(DBEnvObject* self) | ||
587 | { | ||
588 | @@ -5629,7 +5644,6 @@ DBEnv_get_lg_regionmax(DBEnvObject* self) | ||
589 | RETURN_IF_ERR(); | ||
590 | return NUMBER_FromLong(lg_regionmax); | ||
591 | } | ||
592 | -#endif | ||
593 | |||
594 | #if (DBVER >= 47) | ||
595 | static PyObject* | ||
596 | @@ -5680,7 +5694,6 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args) | ||
597 | RETURN_NONE(); | ||
598 | } | ||
599 | |||
600 | -#if (DBVER >= 42) | ||
601 | static PyObject* | ||
602 | DBEnv_get_lk_detect(DBEnvObject* self) | ||
603 | { | ||
604 | @@ -5695,8 +5708,6 @@ DBEnv_get_lk_detect(DBEnvObject* self) | ||
605 | RETURN_IF_ERR(); | ||
606 | return NUMBER_FromLong(lk_detect); | ||
607 | } | ||
608 | -#endif | ||
609 | - | ||
610 | |||
611 | #if (DBVER < 45) | ||
612 | static PyObject* | ||
613 | @@ -5734,7 +5745,6 @@ DBEnv_set_lk_max_locks(DBEnvObject* self, PyObject* args) | ||
614 | RETURN_NONE(); | ||
615 | } | ||
616 | |||
617 | -#if (DBVER >= 42) | ||
618 | static PyObject* | ||
619 | DBEnv_get_lk_max_locks(DBEnvObject* self) | ||
620 | { | ||
621 | @@ -5749,7 +5759,6 @@ DBEnv_get_lk_max_locks(DBEnvObject* self) | ||
622 | RETURN_IF_ERR(); | ||
623 | return NUMBER_FromLong(lk_max); | ||
624 | } | ||
625 | -#endif | ||
626 | |||
627 | static PyObject* | ||
628 | DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args) | ||
629 | @@ -5767,7 +5776,6 @@ DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args) | ||
630 | RETURN_NONE(); | ||
631 | } | ||
632 | |||
633 | -#if (DBVER >= 42) | ||
634 | static PyObject* | ||
635 | DBEnv_get_lk_max_lockers(DBEnvObject* self) | ||
636 | { | ||
637 | @@ -5782,7 +5790,6 @@ DBEnv_get_lk_max_lockers(DBEnvObject* self) | ||
638 | RETURN_IF_ERR(); | ||
639 | return NUMBER_FromLong(lk_max); | ||
640 | } | ||
641 | -#endif | ||
642 | |||
643 | static PyObject* | ||
644 | DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args) | ||
645 | @@ -5800,7 +5807,6 @@ DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args) | ||
646 | RETURN_NONE(); | ||
647 | } | ||
648 | |||
649 | -#if (DBVER >= 42) | ||
650 | static PyObject* | ||
651 | DBEnv_get_lk_max_objects(DBEnvObject* self) | ||
652 | { | ||
653 | @@ -5815,9 +5821,7 @@ DBEnv_get_lk_max_objects(DBEnvObject* self) | ||
654 | RETURN_IF_ERR(); | ||
655 | return NUMBER_FromLong(lk_max); | ||
656 | } | ||
657 | -#endif | ||
658 | |||
659 | -#if (DBVER >= 42) | ||
660 | static PyObject* | ||
661 | DBEnv_get_mp_mmapsize(DBEnvObject* self) | ||
662 | { | ||
663 | @@ -5832,8 +5836,6 @@ DBEnv_get_mp_mmapsize(DBEnvObject* self) | ||
664 | RETURN_IF_ERR(); | ||
665 | return NUMBER_FromLong(mmapsize); | ||
666 | } | ||
667 | -#endif | ||
668 | - | ||
669 | |||
670 | static PyObject* | ||
671 | DBEnv_set_mp_mmapsize(DBEnvObject* self, PyObject* args) | ||
672 | @@ -5869,8 +5871,6 @@ DBEnv_set_tmp_dir(DBEnvObject* self, PyObject* args) | ||
673 | RETURN_NONE(); | ||
674 | } | ||
675 | |||
676 | - | ||
677 | -#if (DBVER >= 42) | ||
678 | static PyObject* | ||
679 | DBEnv_get_tmp_dir(DBEnvObject* self) | ||
680 | { | ||
681 | @@ -5887,8 +5887,6 @@ DBEnv_get_tmp_dir(DBEnvObject* self) | ||
682 | |||
683 | return PyBytes_FromString(dirpp); | ||
684 | } | ||
685 | -#endif | ||
686 | - | ||
687 | |||
688 | static PyObject* | ||
689 | DBEnv_txn_recover(DBEnvObject* self) | ||
690 | @@ -5899,7 +5897,7 @@ DBEnv_txn_recover(DBEnvObject* self) | ||
691 | DBTxnObject *txn; | ||
692 | #define PREPLIST_LEN 16 | ||
693 | DB_PREPLIST preplist[PREPLIST_LEN]; | ||
694 | -#if (DBVER < 48) | ||
695 | +#if (DBVER < 48 || DBVER > 51) | ||
696 | long retp; | ||
697 | #else | ||
698 | u_int32_t retp; | ||
699 | @@ -6003,8 +6001,6 @@ DBEnv_txn_checkpoint(DBEnvObject* self, PyObject* args) | ||
700 | RETURN_NONE(); | ||
701 | } | ||
702 | |||
703 | - | ||
704 | -#if (DBVER >= 42) | ||
705 | static PyObject* | ||
706 | DBEnv_get_tx_max(DBEnvObject* self) | ||
707 | { | ||
708 | @@ -6019,8 +6015,6 @@ DBEnv_get_tx_max(DBEnvObject* self) | ||
709 | RETURN_IF_ERR(); | ||
710 | return PyLong_FromUnsignedLong(max); | ||
711 | } | ||
712 | -#endif | ||
713 | - | ||
714 | |||
715 | static PyObject* | ||
716 | DBEnv_set_tx_max(DBEnvObject* self, PyObject* args) | ||
717 | @@ -6038,8 +6032,6 @@ DBEnv_set_tx_max(DBEnvObject* self, PyObject* args) | ||
718 | RETURN_NONE(); | ||
719 | } | ||
720 | |||
721 | - | ||
722 | -#if (DBVER >= 42) | ||
723 | static PyObject* | ||
724 | DBEnv_get_tx_timestamp(DBEnvObject* self) | ||
725 | { | ||
726 | @@ -6054,7 +6046,6 @@ DBEnv_get_tx_timestamp(DBEnvObject* self) | ||
727 | RETURN_IF_ERR(); | ||
728 | return NUMBER_FromLong(timestamp); | ||
729 | } | ||
730 | -#endif | ||
731 | |||
732 | static PyObject* | ||
733 | DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args) | ||
734 | @@ -6756,6 +6747,55 @@ DBEnv_set_private(DBEnvObject* self, PyObject* private_obj) | ||
735 | RETURN_NONE(); | ||
736 | } | ||
737 | |||
738 | +#if (DBVER >= 47) | ||
739 | +static PyObject* | ||
740 | +DBEnv_set_intermediate_dir_mode(DBEnvObject* self, PyObject* args) | ||
741 | +{ | ||
742 | + int err; | ||
743 | + const char *mode; | ||
744 | + | ||
745 | + if (!PyArg_ParseTuple(args,"s:set_intermediate_dir_mode", &mode)) | ||
746 | + return NULL; | ||
747 | + | ||
748 | + CHECK_ENV_NOT_CLOSED(self); | ||
749 | + | ||
750 | + MYDB_BEGIN_ALLOW_THREADS; | ||
751 | + err = self->db_env->set_intermediate_dir_mode(self->db_env, mode); | ||
752 | + MYDB_END_ALLOW_THREADS; | ||
753 | + RETURN_IF_ERR(); | ||
754 | + RETURN_NONE(); | ||
755 | +} | ||
756 | + | ||
757 | +static PyObject* | ||
758 | +DBEnv_get_intermediate_dir_mode(DBEnvObject* self) | ||
759 | +{ | ||
760 | + int err; | ||
761 | + const char *mode; | ||
762 | + | ||
763 | + CHECK_ENV_NOT_CLOSED(self); | ||
764 | + | ||
765 | + MYDB_BEGIN_ALLOW_THREADS; | ||
766 | + err = self->db_env->get_intermediate_dir_mode(self->db_env, &mode); | ||
767 | + MYDB_END_ALLOW_THREADS; | ||
768 | + RETURN_IF_ERR(); | ||
769 | + return Py_BuildValue("s", mode); | ||
770 | +} | ||
771 | +#endif | ||
772 | + | ||
773 | +static PyObject* | ||
774 | +DBEnv_get_open_flags(DBEnvObject* self) | ||
775 | +{ | ||
776 | + int err; | ||
777 | + unsigned int flags; | ||
778 | + | ||
779 | + CHECK_ENV_NOT_CLOSED(self); | ||
780 | + | ||
781 | + MYDB_BEGIN_ALLOW_THREADS; | ||
782 | + err = self->db_env->get_open_flags(self->db_env, &flags); | ||
783 | + MYDB_END_ALLOW_THREADS; | ||
784 | + RETURN_IF_ERR(); | ||
785 | + return NUMBER_FromLong(flags); | ||
786 | +} | ||
787 | |||
788 | #if (DBVER < 48) | ||
789 | static PyObject* | ||
790 | @@ -6875,7 +6915,6 @@ DBEnv_set_verbose(DBEnvObject* self, PyObject* args) | ||
791 | RETURN_NONE(); | ||
792 | } | ||
793 | |||
794 | -#if (DBVER >= 42) | ||
795 | static PyObject* | ||
796 | DBEnv_get_verbose(DBEnvObject* self, PyObject* args) | ||
797 | { | ||
798 | @@ -6893,7 +6932,6 @@ DBEnv_get_verbose(DBEnvObject* self, PyObject* args) | ||
799 | RETURN_IF_ERR(); | ||
800 | return PyBool_FromLong(verbose); | ||
801 | } | ||
802 | -#endif | ||
803 | |||
804 | #if (DBVER >= 45) | ||
805 | static void | ||
806 | @@ -6975,9 +7013,7 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args) | ||
807 | PyObject *control_py, *rec_py; | ||
808 | DBT control, rec; | ||
809 | int envid; | ||
810 | -#if (DBVER >= 42) | ||
811 | DB_LSN lsn; | ||
812 | -#endif | ||
813 | |||
814 | if (!PyArg_ParseTuple(args, "OOi:rep_process_message", &control_py, | ||
815 | &rec_py, &envid)) | ||
816 | @@ -6994,13 +7030,8 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args) | ||
817 | err = self->db_env->rep_process_message(self->db_env, &control, &rec, | ||
818 | envid, &lsn); | ||
819 | #else | ||
820 | -#if (DBVER >= 42) | ||
821 | err = self->db_env->rep_process_message(self->db_env, &control, &rec, | ||
822 | &envid, &lsn); | ||
823 | -#else | ||
824 | - err = self->db_env->rep_process_message(self->db_env, &control, &rec, | ||
825 | - &envid); | ||
826 | -#endif | ||
827 | #endif | ||
828 | MYDB_END_ALLOW_THREADS; | ||
829 | switch (err) { | ||
830 | @@ -7029,12 +7060,10 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args) | ||
831 | return r; | ||
832 | break; | ||
833 | } | ||
834 | -#if (DBVER >= 42) | ||
835 | case DB_REP_NOTPERM : | ||
836 | case DB_REP_ISPERM : | ||
837 | return Py_BuildValue("(i(ll))", err, lsn.file, lsn.offset); | ||
838 | break; | ||
839 | -#endif | ||
840 | } | ||
841 | RETURN_IF_ERR(); | ||
842 | return Py_BuildValue("(OO)", Py_None, Py_None); | ||
843 | @@ -7086,20 +7115,6 @@ _DBEnv_rep_transportCallback(DB_ENV* db_env, const DBT* control, const DBT* rec, | ||
844 | return ret; | ||
845 | } | ||
846 | |||
847 | -#if (DBVER <= 41) | ||
848 | -static int | ||
849 | -_DBEnv_rep_transportCallbackOLD(DB_ENV* db_env, const DBT* control, const DBT* rec, | ||
850 | - int envid, u_int32_t flags) | ||
851 | -{ | ||
852 | - DB_LSN lsn; | ||
853 | - | ||
854 | - lsn.file = -1; /* Dummy values */ | ||
855 | - lsn.offset = -1; | ||
856 | - return _DBEnv_rep_transportCallback(db_env, control, rec, &lsn, envid, | ||
857 | - flags); | ||
858 | -} | ||
859 | -#endif | ||
860 | - | ||
861 | static PyObject* | ||
862 | DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args) | ||
863 | { | ||
864 | @@ -7120,13 +7135,8 @@ DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args) | ||
865 | err = self->db_env->rep_set_transport(self->db_env, envid, | ||
866 | &_DBEnv_rep_transportCallback); | ||
867 | #else | ||
868 | -#if (DBVER >= 42) | ||
869 | err = self->db_env->set_rep_transport(self->db_env, envid, | ||
870 | &_DBEnv_rep_transportCallback); | ||
871 | -#else | ||
872 | - err = self->db_env->set_rep_transport(self->db_env, envid, | ||
873 | - &_DBEnv_rep_transportCallbackOLD); | ||
874 | -#endif | ||
875 | #endif | ||
876 | MYDB_END_ALLOW_THREADS; | ||
877 | RETURN_IF_ERR(); | ||
878 | @@ -7608,6 +7618,7 @@ DBEnv_repmgr_start(DBEnvObject* self, PyObject* args, PyObject* | ||
879 | RETURN_NONE(); | ||
880 | } | ||
881 | |||
882 | +#if (DBVER < 52) | ||
883 | static PyObject* | ||
884 | DBEnv_repmgr_set_local_site(DBEnvObject* self, PyObject* args, PyObject* | ||
885 | kwargs) | ||
886 | @@ -7654,6 +7665,7 @@ DBEnv_repmgr_add_remote_site(DBEnvObject* self, PyObject* args, PyObject* | ||
887 | RETURN_IF_ERR(); | ||
888 | return NUMBER_FromLong(eidp); | ||
889 | } | ||
890 | +#endif | ||
891 | |||
892 | static PyObject* | ||
893 | DBEnv_repmgr_set_ack_policy(DBEnvObject* self, PyObject* args) | ||
894 | @@ -8482,65 +8494,43 @@ static PyMethodDef DB_methods[] = { | ||
895 | {"remove", (PyCFunction)DB_remove, METH_VARARGS|METH_KEYWORDS}, | ||
896 | {"rename", (PyCFunction)DB_rename, METH_VARARGS}, | ||
897 | {"set_bt_minkey", (PyCFunction)DB_set_bt_minkey, METH_VARARGS}, | ||
898 | -#if (DBVER >= 42) | ||
899 | {"get_bt_minkey", (PyCFunction)DB_get_bt_minkey, METH_NOARGS}, | ||
900 | -#endif | ||
901 | {"set_bt_compare", (PyCFunction)DB_set_bt_compare, METH_O}, | ||
902 | {"set_cachesize", (PyCFunction)DB_set_cachesize, METH_VARARGS}, | ||
903 | -#if (DBVER >= 42) | ||
904 | {"get_cachesize", (PyCFunction)DB_get_cachesize, METH_NOARGS}, | ||
905 | -#endif | ||
906 | {"set_encrypt", (PyCFunction)DB_set_encrypt, METH_VARARGS|METH_KEYWORDS}, | ||
907 | -#if (DBVER >= 42) | ||
908 | {"get_encrypt_flags", (PyCFunction)DB_get_encrypt_flags, METH_NOARGS}, | ||
909 | -#endif | ||
910 | - | ||
911 | {"set_flags", (PyCFunction)DB_set_flags, METH_VARARGS}, | ||
912 | -#if (DBVER >= 42) | ||
913 | {"get_flags", (PyCFunction)DB_get_flags, METH_NOARGS}, | ||
914 | +#if (DBVER >= 43) | ||
915 | + {"get_transactional", (PyCFunction)DB_get_transactional, METH_NOARGS}, | ||
916 | #endif | ||
917 | {"set_h_ffactor", (PyCFunction)DB_set_h_ffactor, METH_VARARGS}, | ||
918 | -#if (DBVER >= 42) | ||
919 | {"get_h_ffactor", (PyCFunction)DB_get_h_ffactor, METH_NOARGS}, | ||
920 | -#endif | ||
921 | {"set_h_nelem", (PyCFunction)DB_set_h_nelem, METH_VARARGS}, | ||
922 | -#if (DBVER >= 42) | ||
923 | {"get_h_nelem", (PyCFunction)DB_get_h_nelem, METH_NOARGS}, | ||
924 | -#endif | ||
925 | {"set_lorder", (PyCFunction)DB_set_lorder, METH_VARARGS}, | ||
926 | -#if (DBVER >= 42) | ||
927 | {"get_lorder", (PyCFunction)DB_get_lorder, METH_NOARGS}, | ||
928 | -#endif | ||
929 | {"set_pagesize", (PyCFunction)DB_set_pagesize, METH_VARARGS}, | ||
930 | -#if (DBVER >= 42) | ||
931 | {"get_pagesize", (PyCFunction)DB_get_pagesize, METH_NOARGS}, | ||
932 | -#endif | ||
933 | {"set_re_delim", (PyCFunction)DB_set_re_delim, METH_VARARGS}, | ||
934 | -#if (DBVER >= 42) | ||
935 | {"get_re_delim", (PyCFunction)DB_get_re_delim, METH_NOARGS}, | ||
936 | -#endif | ||
937 | {"set_re_len", (PyCFunction)DB_set_re_len, METH_VARARGS}, | ||
938 | -#if (DBVER >= 42) | ||
939 | {"get_re_len", (PyCFunction)DB_get_re_len, METH_NOARGS}, | ||
940 | -#endif | ||
941 | {"set_re_pad", (PyCFunction)DB_set_re_pad, METH_VARARGS}, | ||
942 | -#if (DBVER >= 42) | ||
943 | {"get_re_pad", (PyCFunction)DB_get_re_pad, METH_NOARGS}, | ||
944 | -#endif | ||
945 | {"set_re_source", (PyCFunction)DB_set_re_source, METH_VARARGS}, | ||
946 | -#if (DBVER >= 42) | ||
947 | {"get_re_source", (PyCFunction)DB_get_re_source, METH_NOARGS}, | ||
948 | -#endif | ||
949 | {"set_q_extentsize",(PyCFunction)DB_set_q_extentsize, METH_VARARGS}, | ||
950 | -#if (DBVER >= 42) | ||
951 | {"get_q_extentsize",(PyCFunction)DB_get_q_extentsize, METH_NOARGS}, | ||
952 | -#endif | ||
953 | {"set_private", (PyCFunction)DB_set_private, METH_O}, | ||
954 | {"get_private", (PyCFunction)DB_get_private, METH_NOARGS}, | ||
955 | #if (DBVER >= 46) | ||
956 | {"set_priority", (PyCFunction)DB_set_priority, METH_VARARGS}, | ||
957 | {"get_priority", (PyCFunction)DB_get_priority, METH_NOARGS}, | ||
958 | #endif | ||
959 | + {"get_dbname", (PyCFunction)DB_get_dbname, METH_NOARGS}, | ||
960 | + {"get_open_flags", (PyCFunction)DB_get_open_flags, METH_NOARGS}, | ||
961 | {"stat", (PyCFunction)DB_stat, METH_VARARGS|METH_KEYWORDS}, | ||
962 | #if (DBVER >= 43) | ||
963 | {"stat_print", (PyCFunction)DB_stat_print, | ||
964 | @@ -8639,24 +8629,18 @@ static PyMethodDef DBEnv_methods[] = { | ||
965 | {"get_thread_count", (PyCFunction)DBEnv_get_thread_count, METH_NOARGS}, | ||
966 | #endif | ||
967 | {"set_encrypt", (PyCFunction)DBEnv_set_encrypt, METH_VARARGS|METH_KEYWORDS}, | ||
968 | -#if (DBVER >= 42) | ||
969 | {"get_encrypt_flags", (PyCFunction)DBEnv_get_encrypt_flags, METH_NOARGS}, | ||
970 | {"get_timeout", (PyCFunction)DBEnv_get_timeout, | ||
971 | METH_VARARGS|METH_KEYWORDS}, | ||
972 | -#endif | ||
973 | {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS}, | ||
974 | {"set_shm_key", (PyCFunction)DBEnv_set_shm_key, METH_VARARGS}, | ||
975 | -#if (DBVER >= 42) | ||
976 | {"get_shm_key", (PyCFunction)DBEnv_get_shm_key, METH_NOARGS}, | ||
977 | -#endif | ||
978 | #if (DBVER >= 46) | ||
979 | {"set_cache_max", (PyCFunction)DBEnv_set_cache_max, METH_VARARGS}, | ||
980 | {"get_cache_max", (PyCFunction)DBEnv_get_cache_max, METH_NOARGS}, | ||
981 | #endif | ||
982 | {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, | ||
983 | -#if (DBVER >= 42) | ||
984 | {"get_cachesize", (PyCFunction)DBEnv_get_cachesize, METH_NOARGS}, | ||
985 | -#endif | ||
986 | {"memp_trickle", (PyCFunction)DBEnv_memp_trickle, METH_VARARGS}, | ||
987 | {"memp_sync", (PyCFunction)DBEnv_memp_sync, METH_VARARGS}, | ||
988 | {"memp_stat", (PyCFunction)DBEnv_memp_stat, | ||
989 | @@ -8685,33 +8669,21 @@ static PyMethodDef DBEnv_methods[] = { | ||
990 | #endif | ||
991 | #endif | ||
992 | {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS}, | ||
993 | -#if (DBVER >= 42) | ||
994 | {"get_data_dirs", (PyCFunction)DBEnv_get_data_dirs, METH_NOARGS}, | ||
995 | -#endif | ||
996 | -#if (DBVER >= 42) | ||
997 | {"get_flags", (PyCFunction)DBEnv_get_flags, METH_NOARGS}, | ||
998 | -#endif | ||
999 | {"set_flags", (PyCFunction)DBEnv_set_flags, METH_VARARGS}, | ||
1000 | #if (DBVER >= 47) | ||
1001 | {"log_set_config", (PyCFunction)DBEnv_log_set_config, METH_VARARGS}, | ||
1002 | {"log_get_config", (PyCFunction)DBEnv_log_get_config, METH_VARARGS}, | ||
1003 | #endif | ||
1004 | {"set_lg_bsize", (PyCFunction)DBEnv_set_lg_bsize, METH_VARARGS}, | ||
1005 | -#if (DBVER >= 42) | ||
1006 | {"get_lg_bsize", (PyCFunction)DBEnv_get_lg_bsize, METH_NOARGS}, | ||
1007 | -#endif | ||
1008 | {"set_lg_dir", (PyCFunction)DBEnv_set_lg_dir, METH_VARARGS}, | ||
1009 | -#if (DBVER >= 42) | ||
1010 | {"get_lg_dir", (PyCFunction)DBEnv_get_lg_dir, METH_NOARGS}, | ||
1011 | -#endif | ||
1012 | {"set_lg_max", (PyCFunction)DBEnv_set_lg_max, METH_VARARGS}, | ||
1013 | -#if (DBVER >= 42) | ||
1014 | {"get_lg_max", (PyCFunction)DBEnv_get_lg_max, METH_NOARGS}, | ||
1015 | -#endif | ||
1016 | {"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS}, | ||
1017 | -#if (DBVER >= 42) | ||
1018 | {"get_lg_regionmax",(PyCFunction)DBEnv_get_lg_regionmax, METH_NOARGS}, | ||
1019 | -#endif | ||
1020 | #if (DBVER >= 44) | ||
1021 | {"set_lg_filemode", (PyCFunction)DBEnv_set_lg_filemode, METH_VARARGS}, | ||
1022 | {"get_lg_filemode", (PyCFunction)DBEnv_get_lg_filemode, METH_NOARGS}, | ||
1023 | @@ -8721,36 +8693,24 @@ static PyMethodDef DBEnv_methods[] = { | ||
1024 | {"get_lk_partitions", (PyCFunction)DBEnv_get_lk_partitions, METH_NOARGS}, | ||
1025 | #endif | ||
1026 | {"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS}, | ||
1027 | -#if (DBVER >= 42) | ||
1028 | {"get_lk_detect", (PyCFunction)DBEnv_get_lk_detect, METH_NOARGS}, | ||
1029 | -#endif | ||
1030 | #if (DBVER < 45) | ||
1031 | {"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS}, | ||
1032 | #endif | ||
1033 | {"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS}, | ||
1034 | -#if (DBVER >= 42) | ||
1035 | {"get_lk_max_locks", (PyCFunction)DBEnv_get_lk_max_locks, METH_NOARGS}, | ||
1036 | -#endif | ||
1037 | {"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS}, | ||
1038 | -#if (DBVER >= 42) | ||
1039 | {"get_lk_max_lockers", (PyCFunction)DBEnv_get_lk_max_lockers, METH_NOARGS}, | ||
1040 | -#endif | ||
1041 | {"set_lk_max_objects", (PyCFunction)DBEnv_set_lk_max_objects, METH_VARARGS}, | ||
1042 | -#if (DBVER >= 42) | ||
1043 | {"get_lk_max_objects", (PyCFunction)DBEnv_get_lk_max_objects, METH_NOARGS}, | ||
1044 | -#endif | ||
1045 | #if (DBVER >= 43) | ||
1046 | {"stat_print", (PyCFunction)DBEnv_stat_print, | ||
1047 | METH_VARARGS|METH_KEYWORDS}, | ||
1048 | #endif | ||
1049 | {"set_mp_mmapsize", (PyCFunction)DBEnv_set_mp_mmapsize, METH_VARARGS}, | ||
1050 | -#if (DBVER >= 42) | ||
1051 | {"get_mp_mmapsize", (PyCFunction)DBEnv_get_mp_mmapsize, METH_NOARGS}, | ||
1052 | -#endif | ||
1053 | {"set_tmp_dir", (PyCFunction)DBEnv_set_tmp_dir, METH_VARARGS}, | ||
1054 | -#if (DBVER >= 42) | ||
1055 | {"get_tmp_dir", (PyCFunction)DBEnv_get_tmp_dir, METH_NOARGS}, | ||
1056 | -#endif | ||
1057 | {"txn_begin", (PyCFunction)DBEnv_txn_begin, METH_VARARGS|METH_KEYWORDS}, | ||
1058 | {"txn_checkpoint", (PyCFunction)DBEnv_txn_checkpoint, METH_VARARGS}, | ||
1059 | {"txn_stat", (PyCFunction)DBEnv_txn_stat, METH_VARARGS}, | ||
1060 | @@ -8758,10 +8718,8 @@ static PyMethodDef DBEnv_methods[] = { | ||
1061 | {"txn_stat_print", (PyCFunction)DBEnv_txn_stat_print, | ||
1062 | METH_VARARGS|METH_KEYWORDS}, | ||
1063 | #endif | ||
1064 | -#if (DBVER >= 42) | ||
1065 | {"get_tx_max", (PyCFunction)DBEnv_get_tx_max, METH_NOARGS}, | ||
1066 | {"get_tx_timestamp", (PyCFunction)DBEnv_get_tx_timestamp, METH_NOARGS}, | ||
1067 | -#endif | ||
1068 | {"set_tx_max", (PyCFunction)DBEnv_set_tx_max, METH_VARARGS}, | ||
1069 | {"set_tx_timestamp", (PyCFunction)DBEnv_set_tx_timestamp, METH_VARARGS}, | ||
1070 | {"lock_detect", (PyCFunction)DBEnv_lock_detect, METH_VARARGS}, | ||
1071 | @@ -8804,11 +8762,16 @@ static PyMethodDef DBEnv_methods[] = { | ||
1072 | {"get_mp_max_write", (PyCFunction)DBEnv_get_mp_max_write, METH_NOARGS}, | ||
1073 | #endif | ||
1074 | {"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS}, | ||
1075 | -#if (DBVER >= 42) | ||
1076 | - {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, | ||
1077 | + {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, | ||
1078 | + {"set_private", (PyCFunction)DBEnv_set_private, METH_O}, | ||
1079 | + {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS}, | ||
1080 | + {"get_open_flags", (PyCFunction)DBEnv_get_open_flags, METH_NOARGS}, | ||
1081 | +#if (DBVER >= 47) | ||
1082 | + {"set_intermediate_dir_mode", (PyCFunction)DBEnv_set_intermediate_dir_mode, | ||
1083 | + METH_VARARGS}, | ||
1084 | + {"get_intermediate_dir_mode", (PyCFunction)DBEnv_get_intermediate_dir_mode, | ||
1085 | + METH_NOARGS}, | ||
1086 | #endif | ||
1087 | - {"set_private", (PyCFunction)DBEnv_set_private, METH_O}, | ||
1088 | - {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS}, | ||
1089 | {"rep_start", (PyCFunction)DBEnv_rep_start, | ||
1090 | METH_VARARGS|METH_KEYWORDS}, | ||
1091 | {"rep_set_transport", (PyCFunction)DBEnv_rep_set_transport, METH_VARARGS}, | ||
1092 | @@ -8855,10 +8818,12 @@ static PyMethodDef DBEnv_methods[] = { | ||
1093 | #if (DBVER >= 45) | ||
1094 | {"repmgr_start", (PyCFunction)DBEnv_repmgr_start, | ||
1095 | METH_VARARGS|METH_KEYWORDS}, | ||
1096 | +#if (DBVER < 52) | ||
1097 | {"repmgr_set_local_site", (PyCFunction)DBEnv_repmgr_set_local_site, | ||
1098 | METH_VARARGS|METH_KEYWORDS}, | ||
1099 | {"repmgr_add_remote_site", (PyCFunction)DBEnv_repmgr_add_remote_site, | ||
1100 | METH_VARARGS|METH_KEYWORDS}, | ||
1101 | +#endif | ||
1102 | {"repmgr_set_ack_policy", (PyCFunction)DBEnv_repmgr_set_ack_policy, | ||
1103 | METH_VARARGS}, | ||
1104 | {"repmgr_get_ack_policy", (PyCFunction)DBEnv_repmgr_get_ack_policy, | ||
1105 | @@ -8922,13 +8887,9 @@ DBEnv_db_home_get(DBEnvObject* self) | ||
1106 | |||
1107 | CHECK_ENV_NOT_CLOSED(self); | ||
1108 | |||
1109 | -#if (DBVER >= 42) | ||
1110 | MYDB_BEGIN_ALLOW_THREADS; | ||
1111 | self->db_env->get_home(self->db_env, &home); | ||
1112 | MYDB_END_ALLOW_THREADS; | ||
1113 | -#else | ||
1114 | - home=self->db_env->db_home; | ||
1115 | -#endif | ||
1116 | |||
1117 | if (home == NULL) { | ||
1118 | RETURN_NONE(); | ||
1119 | @@ -9298,10 +9259,25 @@ bsddb_version(PyObject* self) | ||
1120 | { | ||
1121 | int major, minor, patch; | ||
1122 | |||
1123 | + /* This should be instantaneous, no need to release the GIL */ | ||
1124 | db_version(&major, &minor, &patch); | ||
1125 | return Py_BuildValue("(iii)", major, minor, patch); | ||
1126 | } | ||
1127 | |||
1128 | +#if (DBVER >= 50) | ||
1129 | +static PyObject* | ||
1130 | +bsddb_version_full(PyObject* self) | ||
1131 | +{ | ||
1132 | + char *version_string; | ||
1133 | + int family, release, major, minor, patch; | ||
1134 | + | ||
1135 | + /* This should be instantaneous, no need to release the GIL */ | ||
1136 | + version_string = db_full_version(&family, &release, &major, &minor, &patch); | ||
1137 | + return Py_BuildValue("(siiiii)", | ||
1138 | + version_string, family, release, major, minor, patch); | ||
1139 | +} | ||
1140 | +#endif | ||
1141 | + | ||
1142 | |||
1143 | /* List of functions defined in the module */ | ||
1144 | static PyMethodDef bsddb_methods[] = { | ||
1145 | @@ -9311,6 +9287,9 @@ static PyMethodDef bsddb_methods[] = { | ||
1146 | {"DBSequence", (PyCFunction)DBSequence_construct, METH_VARARGS | METH_KEYWORDS }, | ||
1147 | #endif | ||
1148 | {"version", (PyCFunction)bsddb_version, METH_NOARGS, bsddb_version_doc}, | ||
1149 | +#if (DBVER >= 50) | ||
1150 | + {"full_version", (PyCFunction)bsddb_version_full, METH_NOARGS}, | ||
1151 | +#endif | ||
1152 | {NULL, NULL} /* sentinel */ | ||
1153 | }; | ||
1154 | |||
1155 | @@ -9328,6 +9307,11 @@ static BSDDB_api bsddb_api; | ||
1156 | */ | ||
1157 | #define ADD_INT(dict, NAME) _addIntToDict(dict, #NAME, NAME) | ||
1158 | |||
1159 | +/* | ||
1160 | +** We can rename the module at import time, so the string allocated | ||
1161 | +** must be big enough, and any use of the name must use this particular | ||
1162 | +** string. | ||
1163 | +*/ | ||
1164 | #define MODULE_NAME_MAX_LEN 11 | ||
1165 | static char _bsddbModuleName[MODULE_NAME_MAX_LEN+1] = "_bsddb"; | ||
1166 | |||
1167 | @@ -9428,16 +9412,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1168 | ADD_INT(d, DB_MAX_RECORDS); | ||
1169 | |||
1170 | #if (DBVER < 48) | ||
1171 | -#if (DBVER >= 42) | ||
1172 | ADD_INT(d, DB_RPCCLIENT); | ||
1173 | -#else | ||
1174 | - ADD_INT(d, DB_CLIENT); | ||
1175 | - /* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */ | ||
1176 | - _addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT); | ||
1177 | -#endif | ||
1178 | #endif | ||
1179 | |||
1180 | -#if (DBVER < 48) | ||
1181 | +#if (DBVER < 48 || DBVER > 51) | ||
1182 | ADD_INT(d, DB_XA_CREATE); | ||
1183 | #endif | ||
1184 | |||
1185 | @@ -9477,6 +9455,14 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1186 | ADD_INT(d, DB_TXN_SYNC); | ||
1187 | ADD_INT(d, DB_TXN_NOWAIT); | ||
1188 | |||
1189 | +#if (DBVER >= 51) | ||
1190 | + ADD_INT(d, DB_TXN_BULK); | ||
1191 | +#endif | ||
1192 | + | ||
1193 | +#if (DBVER >= 48) | ||
1194 | + ADD_INT(d, DB_CURSOR_BULK); | ||
1195 | +#endif | ||
1196 | + | ||
1197 | #if (DBVER >= 46) | ||
1198 | ADD_INT(d, DB_TXN_WAIT); | ||
1199 | #endif | ||
1200 | @@ -9561,9 +9547,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1201 | ADD_INT(d, DB_ARCH_ABS); | ||
1202 | ADD_INT(d, DB_ARCH_DATA); | ||
1203 | ADD_INT(d, DB_ARCH_LOG); | ||
1204 | -#if (DBVER >= 42) | ||
1205 | ADD_INT(d, DB_ARCH_REMOVE); | ||
1206 | -#endif | ||
1207 | |||
1208 | ADD_INT(d, DB_BTREE); | ||
1209 | ADD_INT(d, DB_HASH); | ||
1210 | @@ -9591,9 +9575,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1211 | ADD_INT(d, DB_CACHED_COUNTS); | ||
1212 | #endif | ||
1213 | |||
1214 | -#if (DBVER <= 41) | ||
1215 | - ADD_INT(d, DB_COMMIT); | ||
1216 | -#endif | ||
1217 | ADD_INT(d, DB_CONSUME); | ||
1218 | ADD_INT(d, DB_CONSUME_WAIT); | ||
1219 | ADD_INT(d, DB_CURRENT); | ||
1220 | @@ -9651,8 +9632,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1221 | ADD_INT(d, DB_LOCK_DEADLOCK); | ||
1222 | ADD_INT(d, DB_LOCK_NOTGRANTED); | ||
1223 | ADD_INT(d, DB_NOSERVER); | ||
1224 | +#if (DBVER < 52) | ||
1225 | ADD_INT(d, DB_NOSERVER_HOME); | ||
1226 | ADD_INT(d, DB_NOSERVER_ID); | ||
1227 | +#endif | ||
1228 | ADD_INT(d, DB_NOTFOUND); | ||
1229 | ADD_INT(d, DB_OLD_VERSION); | ||
1230 | ADD_INT(d, DB_RUNRECOVERY); | ||
1231 | @@ -9671,6 +9654,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1232 | #if (DBVER >= 43) | ||
1233 | ADD_INT(d, DB_STAT_SUBSYSTEM); | ||
1234 | ADD_INT(d, DB_STAT_MEMP_HASH); | ||
1235 | + ADD_INT(d, DB_STAT_LOCK_CONF); | ||
1236 | + ADD_INT(d, DB_STAT_LOCK_LOCKERS); | ||
1237 | + ADD_INT(d, DB_STAT_LOCK_OBJECTS); | ||
1238 | + ADD_INT(d, DB_STAT_LOCK_PARAMS); | ||
1239 | #endif | ||
1240 | |||
1241 | #if (DBVER >= 48) | ||
1242 | @@ -9690,7 +9677,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1243 | ADD_INT(d, DB_EID_INVALID); | ||
1244 | ADD_INT(d, DB_EID_BROADCAST); | ||
1245 | |||
1246 | -#if (DBVER >= 42) | ||
1247 | ADD_INT(d, DB_TIME_NOTGRANTED); | ||
1248 | ADD_INT(d, DB_TXN_NOT_DURABLE); | ||
1249 | ADD_INT(d, DB_TXN_WRITE_NOSYNC); | ||
1250 | @@ -9698,9 +9684,8 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1251 | ADD_INT(d, DB_INIT_REP); | ||
1252 | ADD_INT(d, DB_ENCRYPT); | ||
1253 | ADD_INT(d, DB_CHKSUM); | ||
1254 | -#endif | ||
1255 | |||
1256 | -#if (DBVER >= 42) && (DBVER < 47) | ||
1257 | +#if (DBVER < 47) | ||
1258 | ADD_INT(d, DB_LOG_AUTOREMOVE); | ||
1259 | ADD_INT(d, DB_DIRECT_LOG); | ||
1260 | #endif | ||
1261 | @@ -9733,6 +9718,20 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1262 | ADD_INT(d, DB_VERB_REPLICATION); | ||
1263 | ADD_INT(d, DB_VERB_WAITSFOR); | ||
1264 | |||
1265 | +#if (DBVER >= 50) | ||
1266 | + ADD_INT(d, DB_VERB_REP_SYSTEM); | ||
1267 | +#endif | ||
1268 | + | ||
1269 | +#if (DBVER >= 47) | ||
1270 | + ADD_INT(d, DB_VERB_REP_ELECT); | ||
1271 | + ADD_INT(d, DB_VERB_REP_LEASE); | ||
1272 | + ADD_INT(d, DB_VERB_REP_MISC); | ||
1273 | + ADD_INT(d, DB_VERB_REP_MSGS); | ||
1274 | + ADD_INT(d, DB_VERB_REP_SYNC); | ||
1275 | + ADD_INT(d, DB_VERB_REPMGR_CONNFAIL); | ||
1276 | + ADD_INT(d, DB_VERB_REPMGR_MISC); | ||
1277 | +#endif | ||
1278 | + | ||
1279 | #if (DBVER >= 45) | ||
1280 | ADD_INT(d, DB_EVENT_PANIC); | ||
1281 | ADD_INT(d, DB_EVENT_REP_CLIENT); | ||
1282 | @@ -9748,16 +9747,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1283 | ADD_INT(d, DB_EVENT_WRITE_FAILED); | ||
1284 | #endif | ||
1285 | |||
1286 | +#if (DBVER >= 50) | ||
1287 | + ADD_INT(d, DB_REPMGR_CONF_ELECTIONS); | ||
1288 | + ADD_INT(d, DB_EVENT_REP_MASTER_FAILURE); | ||
1289 | + ADD_INT(d, DB_EVENT_REP_DUPMASTER); | ||
1290 | + ADD_INT(d, DB_EVENT_REP_ELECTION_FAILED); | ||
1291 | +#endif | ||
1292 | +#if (DBVER >= 48) | ||
1293 | + ADD_INT(d, DB_EVENT_REG_ALIVE); | ||
1294 | + ADD_INT(d, DB_EVENT_REG_PANIC); | ||
1295 | +#endif | ||
1296 | + | ||
1297 | ADD_INT(d, DB_REP_DUPMASTER); | ||
1298 | ADD_INT(d, DB_REP_HOLDELECTION); | ||
1299 | #if (DBVER >= 44) | ||
1300 | ADD_INT(d, DB_REP_IGNORE); | ||
1301 | ADD_INT(d, DB_REP_JOIN_FAILURE); | ||
1302 | #endif | ||
1303 | -#if (DBVER >= 42) | ||
1304 | ADD_INT(d, DB_REP_ISPERM); | ||
1305 | ADD_INT(d, DB_REP_NOTPERM); | ||
1306 | -#endif | ||
1307 | ADD_INT(d, DB_REP_NEWSITE); | ||
1308 | |||
1309 | ADD_INT(d, DB_REP_MASTER); | ||
1310 | @@ -9766,7 +9774,13 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1311 | ADD_INT(d, DB_REP_PERMANENT); | ||
1312 | |||
1313 | #if (DBVER >= 44) | ||
1314 | +#if (DBVER >= 50) | ||
1315 | + ADD_INT(d, DB_REP_CONF_AUTOINIT); | ||
1316 | +#else | ||
1317 | ADD_INT(d, DB_REP_CONF_NOAUTOINIT); | ||
1318 | +#endif /* 5.0 */ | ||
1319 | +#endif /* 4.4 */ | ||
1320 | +#if (DBVER >= 44) | ||
1321 | ADD_INT(d, DB_REP_CONF_DELAYCLIENT); | ||
1322 | ADD_INT(d, DB_REP_CONF_BULK); | ||
1323 | ADD_INT(d, DB_REP_CONF_NOWAIT); | ||
1324 | @@ -9774,9 +9788,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1325 | ADD_INT(d, DB_REP_REREQUEST); | ||
1326 | #endif | ||
1327 | |||
1328 | -#if (DBVER >= 42) | ||
1329 | ADD_INT(d, DB_REP_NOBUFFER); | ||
1330 | -#endif | ||
1331 | |||
1332 | #if (DBVER >= 46) | ||
1333 | ADD_INT(d, DB_REP_LEASE_EXPIRED); | ||
1334 | @@ -9819,6 +9831,28 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1335 | ADD_INT(d, DB_STAT_ALL); | ||
1336 | #endif | ||
1337 | |||
1338 | +#if (DBVER >= 51) | ||
1339 | + ADD_INT(d, DB_REPMGR_ACKS_ALL_AVAILABLE); | ||
1340 | +#endif | ||
1341 | + | ||
1342 | +#if (DBVER >= 48) | ||
1343 | + ADD_INT(d, DB_REP_CONF_INMEM); | ||
1344 | +#endif | ||
1345 | + | ||
1346 | + ADD_INT(d, DB_TIMEOUT); | ||
1347 | + | ||
1348 | +#if (DBVER >= 50) | ||
1349 | + ADD_INT(d, DB_FORCESYNC); | ||
1350 | +#endif | ||
1351 | + | ||
1352 | +#if (DBVER >= 48) | ||
1353 | + ADD_INT(d, DB_FAILCHK); | ||
1354 | +#endif | ||
1355 | + | ||
1356 | +#if (DBVER >= 51) | ||
1357 | + ADD_INT(d, DB_HOTBACKUP_IN_PROGRESS); | ||
1358 | +#endif | ||
1359 | + | ||
1360 | #if (DBVER >= 43) | ||
1361 | ADD_INT(d, DB_BUFFER_SMALL); | ||
1362 | ADD_INT(d, DB_SEQ_DEC); | ||
1363 | @@ -9856,6 +9890,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1364 | ADD_INT(d, DB_SET_LOCK_TIMEOUT); | ||
1365 | ADD_INT(d, DB_SET_TXN_TIMEOUT); | ||
1366 | |||
1367 | +#if (DBVER >= 48) | ||
1368 | + ADD_INT(d, DB_SET_REG_TIMEOUT); | ||
1369 | +#endif | ||
1370 | + | ||
1371 | /* The exception name must be correct for pickled exception * | ||
1372 | * objects to unpickle properly. */ | ||
1373 | #ifdef PYBSDDB_STANDALONE /* different value needed for standalone pybsddb */ | ||
1374 | @@ -9912,8 +9950,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1375 | MAKE_EX(DBRunRecoveryError); | ||
1376 | MAKE_EX(DBVerifyBadError); | ||
1377 | MAKE_EX(DBNoServerError); | ||
1378 | +#if (DBVER >= 44 && DBVER < 52) | ||
1379 | MAKE_EX(DBNoServerHomeError); | ||
1380 | MAKE_EX(DBNoServerIDError); | ||
1381 | +#endif | ||
1382 | MAKE_EX(DBPageNotFoundError); | ||
1383 | MAKE_EX(DBSecondaryBadError); | ||
1384 | |||
1385 | @@ -9927,9 +9967,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1386 | MAKE_EX(DBNoSuchFileError); | ||
1387 | MAKE_EX(DBPermissionsError); | ||
1388 | |||
1389 | -#if (DBVER >= 42) | ||
1390 | MAKE_EX(DBRepHandleDeadError); | ||
1391 | -#endif | ||
1392 | #if (DBVER >= 44) | ||
1393 | MAKE_EX(DBRepLockoutError); | ||
1394 | #endif | ||
1395 | @@ -9947,6 +9985,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1396 | #undef MAKE_EX | ||
1397 | |||
1398 | /* Initialise the C API structure and add it to the module */ | ||
1399 | + bsddb_api.api_version = PYBSDDB_API_VERSION; | ||
1400 | bsddb_api.db_type = &DB_Type; | ||
1401 | bsddb_api.dbcursor_type = &DBCursor_Type; | ||
1402 | bsddb_api.dblogcursor_type = &DBLogCursor_Type; | ||
1403 | @@ -9955,19 +9994,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ | ||
1404 | bsddb_api.dblock_type = &DBLock_Type; | ||
1405 | #if (DBVER >= 43) | ||
1406 | bsddb_api.dbsequence_type = &DBSequence_Type; | ||
1407 | +#else | ||
1408 | + bsddb_api.dbsequence_type = NULL; | ||
1409 | #endif | ||
1410 | bsddb_api.makeDBError = makeDBError; | ||
1411 | |||
1412 | /* | ||
1413 | - ** Capsules exist from Python 3.1, but I | ||
1414 | - ** don't want to break the API compatibility | ||
1415 | - ** for already published Python versions. | ||
1416 | + ** Capsules exist from Python 2.7 and 3.1. | ||
1417 | + ** We don't support Python 3.0 anymore, so... | ||
1418 | + ** #if (PY_VERSION_HEX < ((PY_MAJOR_VERSION < 3) ? 0x02070000 : 0x03020000)) | ||
1419 | */ | ||
1420 | -#if (PY_VERSION_HEX < 0x03020000) | ||
1421 | +#if (PY_VERSION_HEX < 0x02070000) | ||
1422 | py_api = PyCObject_FromVoidPtr((void*)&bsddb_api, NULL); | ||
1423 | #else | ||
1424 | { | ||
1425 | - char py_api_name[250]; | ||
1426 | + /* | ||
1427 | + ** The data must outlive the call!!. So, the static definition. | ||
1428 | + ** The buffer must be big enough... | ||
1429 | + */ | ||
1430 | + static char py_api_name[MODULE_NAME_MAX_LEN+10]; | ||
1431 | |||
1432 | strcpy(py_api_name, _bsddbModuleName); | ||
1433 | strcat(py_api_name, ".api"); | ||
1434 | diff --git a/Modules/bsddb.h b/Modules/bsddb.h | ||
1435 | index a3a687b..c1d862a 100644 | ||
1436 | --- a/Modules/bsddb.h | ||
1437 | +++ b/Modules/bsddb.h | ||
1438 | @@ -109,7 +109,7 @@ | ||
1439 | #error "eek! DBVER can't handle minor versions > 9" | ||
1440 | #endif | ||
1441 | |||
1442 | -#define PY_BSDDB_VERSION "4.8.4.2" | ||
1443 | +#define PY_BSDDB_VERSION "5.3.15" | ||
1444 | |||
1445 | /* Python object definitions */ | ||
1446 | |||
1447 | @@ -236,7 +236,7 @@ typedef struct DBSequenceObject { | ||
1448 | /* To access the structure from an external module, use code like the | ||
1449 | following (error checking missed out for clarity): | ||
1450 | |||
1451 | - // If you are using Python before 3.2: | ||
1452 | + // If you are using Python before 2.7: | ||
1453 | BSDDB_api* bsddb_api; | ||
1454 | PyObject* mod; | ||
1455 | PyObject* cobj; | ||
1456 | @@ -249,7 +249,7 @@ typedef struct DBSequenceObject { | ||
1457 | Py_DECREF(mod); | ||
1458 | |||
1459 | |||
1460 | - // If you are using Python 3.2 or up: | ||
1461 | + // If you are using Python 2.7 or up: (except Python 3.0, unsupported) | ||
1462 | BSDDB_api* bsddb_api; | ||
1463 | |||
1464 | // Use "bsddb3._pybsddb.api" if you're using | ||
1465 | @@ -257,10 +257,14 @@ typedef struct DBSequenceObject { | ||
1466 | bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1); | ||
1467 | |||
1468 | |||
1469 | + Check "api_version" number before trying to use the API. | ||
1470 | + | ||
1471 | The structure's members must not be changed. | ||
1472 | */ | ||
1473 | |||
1474 | +#define PYBSDDB_API_VERSION 1 | ||
1475 | typedef struct { | ||
1476 | + unsigned int api_version; | ||
1477 | /* Type objects */ | ||
1478 | PyTypeObject* db_type; | ||
1479 | PyTypeObject* dbcursor_type; | ||
1480 | @@ -268,9 +272,7 @@ typedef struct { | ||
1481 | PyTypeObject* dbenv_type; | ||
1482 | PyTypeObject* dbtxn_type; | ||
1483 | PyTypeObject* dblock_type; | ||
1484 | -#if (DBVER >= 43) | ||
1485 | - PyTypeObject* dbsequence_type; | ||
1486 | -#endif | ||
1487 | + PyTypeObject* dbsequence_type; /* If DBVER < 43 -> NULL */ | ||
1488 | |||
1489 | /* Functions */ | ||
1490 | int (*makeDBError)(int err); | ||
1491 | @@ -289,9 +291,9 @@ typedef struct { | ||
1492 | #define DBEnvObject_Check(v) ((v)->ob_type == bsddb_api->dbenv_type) | ||
1493 | #define DBTxnObject_Check(v) ((v)->ob_type == bsddb_api->dbtxn_type) | ||
1494 | #define DBLockObject_Check(v) ((v)->ob_type == bsddb_api->dblock_type) | ||
1495 | -#if (DBVER >= 43) | ||
1496 | -#define DBSequenceObject_Check(v) ((v)->ob_type == bsddb_api->dbsequence_type) | ||
1497 | -#endif | ||
1498 | +#define DBSequenceObject_Check(v) \ | ||
1499 | + ((bsddb_api->dbsequence_type) && \ | ||
1500 | + ((v)->ob_type == bsddb_api->dbsequence_type)) | ||
1501 | |||
1502 | #endif /* COMPILING_BSDDB_C */ | ||
1503 | |||
1504 | diff --git a/setup.py b/setup.py | ||
1505 | index 6b47451..e8ac96c 100644 | ||
1506 | --- a/setup.py | ||
1507 | +++ b/setup.py | ||
1508 | @@ -799,7 +799,7 @@ class PyBuildExt(build_ext): | ||
1509 | # a release. Most open source OSes come with one or more | ||
1510 | # versions of BerkeleyDB already installed. | ||
1511 | |||
1512 | - max_db_ver = (4, 8) | ||
1513 | + max_db_ver = (5, 3) | ||
1514 | min_db_ver = (4, 1) | ||
1515 | db_setup_debug = False # verbose debug prints from this script? | ||
1516 | |||
1517 | @@ -821,7 +821,11 @@ class PyBuildExt(build_ext): | ||
1518 | return True | ||
1519 | |||
1520 | def gen_db_minor_ver_nums(major): | ||
1521 | - if major == 4: | ||
1522 | + if major == 5: | ||
1523 | + for x in range(max_db_ver[1]+1): | ||
1524 | + if allow_db_ver((5, x)): | ||
1525 | + yield x | ||
1526 | + elif major == 4: | ||
1527 | for x in range(max_db_ver[1]+1): | ||
1528 | if allow_db_ver((4, x)): | ||
1529 | yield x | ||
1530 | @@ -835,6 +839,9 @@ class PyBuildExt(build_ext): | ||
1531 | # construct a list of paths to look for the header file in on | ||
1532 | # top of the normal inc_dirs. | ||
1533 | db_inc_paths = [ | ||
1534 | + '/usr/include/db5', | ||
1535 | + '/usr/local/include/db5', | ||
1536 | + '/opt/sfw/include/db5', | ||
1537 | '/usr/include/db4', | ||
1538 | '/usr/local/include/db4', | ||
1539 | '/opt/sfw/include/db4', | ||
1540 | @@ -845,6 +852,16 @@ class PyBuildExt(build_ext): | ||
1541 | '/sw/include/db4', | ||
1542 | '/sw/include/db3', | ||
1543 | ] | ||
1544 | + # 5.x minor number specific paths | ||
1545 | + for x in gen_db_minor_ver_nums(5): | ||
1546 | + db_inc_paths.append('/usr/include/db5%d' % x) | ||
1547 | + db_inc_paths.append('/usr/include/db5.%d' % x) | ||
1548 | + db_inc_paths.append('/usr/local/BerkeleyDB.5.%d/include' % x) | ||
1549 | + db_inc_paths.append('/usr/local/include/db5%d' % x) | ||
1550 | + db_inc_paths.append('/pkg/db-5.%d/include' % x) | ||
1551 | + db_inc_paths.append('/opt/db-5.%d/include' % x) | ||
1552 | + # MacPorts default (http://www.macports.org/) | ||
1553 | + db_inc_paths.append('/opt/local/include/db5%d' % x) | ||
1554 | # 4.x minor number specific paths | ||
1555 | for x in gen_db_minor_ver_nums(4): | ||
1556 | db_inc_paths.append('/usr/include/db4%d' % x) | ||
1557 | @@ -871,6 +888,10 @@ class PyBuildExt(build_ext): | ||
1558 | for dn in inc_dirs: | ||
1559 | std_variants.append(os.path.join(dn, 'db3')) | ||
1560 | std_variants.append(os.path.join(dn, 'db4')) | ||
1561 | + std_variants.append(os.path.join(dn, 'db5')) | ||
1562 | + for x in gen_db_minor_ver_nums(5): | ||
1563 | + std_variants.append(os.path.join(dn, "db5%d"%x)) | ||
1564 | + std_variants.append(os.path.join(dn, "db5.%d"%x)) | ||
1565 | for x in gen_db_minor_ver_nums(4): | ||
1566 | std_variants.append(os.path.join(dn, "db4%d"%x)) | ||
1567 | std_variants.append(os.path.join(dn, "db4.%d"%x)) | ||
1568 | -- | ||
1569 | 1.7.7 | ||
1570 | |||
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch b/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch new file mode 100644 index 0000000000..4b8953a137 --- /dev/null +++ b/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch | |||
@@ -0,0 +1,22 @@ | |||
1 | Remove the RPTH to avoid QA issue warning. | ||
2 | |||
3 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
4 | --- | ||
5 | setup.py | 1 - | ||
6 | 1 files changed, 0 insertions(+), 1 deletions(-) | ||
7 | |||
8 | diff --git a/setup.py b/setup.py | ||
9 | index 83b5e56..1fd5487 100644 | ||
10 | --- a/setup.py | ||
11 | +++ b/setup.py | ||
12 | @@ -1025,7 +1025,6 @@ class PyBuildExt(build_ext): | ||
13 | exts.append(Extension('_bsddb', ['_bsddb.c'], | ||
14 | depends = ['bsddb.h'], | ||
15 | library_dirs=dblib_dir, | ||
16 | - runtime_library_dirs=dblib_dir, | ||
17 | include_dirs=db_incs, | ||
18 | libraries=dblibs)) | ||
19 | else: | ||
20 | -- | ||
21 | 1.7.4 | ||
22 | |||
diff --git a/meta/recipes-devtools/python/python_2.7.3.bb b/meta/recipes-devtools/python/python_2.7.3.bb index d27ff05a18..9c648fec15 100644 --- a/meta/recipes-devtools/python/python_2.7.3.bb +++ b/meta/recipes-devtools/python/python_2.7.3.bb | |||
@@ -1,6 +1,6 @@ | |||
1 | require python.inc | 1 | require python.inc |
2 | DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib" | 2 | DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib" |
3 | PR = "${INC_PR}.1" | 3 | PR = "${INC_PR}.2" |
4 | 4 | ||
5 | DISTRO_SRC_URI ?= "file://sitecustomize.py" | 5 | DISTRO_SRC_URI ?= "file://sitecustomize.py" |
6 | DISTRO_SRC_URI_linuxstdbase = "" | 6 | DISTRO_SRC_URI_linuxstdbase = "" |
@@ -23,9 +23,10 @@ SRC_URI += "\ | |||
23 | file://setuptweaks.patch \ | 23 | file://setuptweaks.patch \ |
24 | file://check-if-target-is-64b-not-host.patch \ | 24 | file://check-if-target-is-64b-not-host.patch \ |
25 | file://search_db_h_in_inc_dirs_and_avoid_warning.patch \ | 25 | file://search_db_h_in_inc_dirs_and_avoid_warning.patch \ |
26 | file://avoid_warning_about_bsddb.patch \ | ||
27 | file://avoid_warning_about_tkinter.patch \ | 26 | file://avoid_warning_about_tkinter.patch \ |
28 | file://avoid_warning_for_sunos_specific_module.patch \ | 27 | file://avoid_warning_for_sunos_specific_module.patch \ |
28 | file://python-2.7.3-berkeley-db-5.3.patch \ | ||
29 | file://python-2.7.3-remove-bsdb-rpath.patch \ | ||
29 | " | 30 | " |
30 | 31 | ||
31 | S = "${WORKDIR}/Python-${PV}" | 32 | S = "${WORKDIR}/Python-${PV}" |