From f067bf6e2cde78ea90ce508625c2ab4c772c1e1b Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 28 Nov 2008 04:28:10 +0000 Subject: [PATCH] Changes with Python 2.5.2 and BSDDB are more subtle---seems to require checking both Python and BSDDB versions. This involves a method name change, and a flag name change. svn: r11354 --- src/gen/db/dbdir.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gen/db/dbdir.py b/src/gen/db/dbdir.py index c44d0aafb..4e54ee775 100644 --- a/src/gen/db/dbdir.py +++ b/src/gen/db/dbdir.py @@ -32,6 +32,7 @@ This is used since GRAMPS version 3.0 #------------------------------------------------------------------------- import cPickle as pickle import os +import sys import time from types import InstanceType @@ -482,12 +483,18 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): self.env.set_lk_max_locks(25000) self.env.set_lk_max_objects(25000) - if db.version() < (4, 7): - # Python 2.5 log settings - self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1) # clean up unused logs + if sys.version_info < (2, 6): + if db.version() < (4, 7): + # Python 2.5 log settings + # clean up unused logs + self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1) + else: + # Python 2.5.2, DB 4.7.25 uses set_flags, too + self.env.set_flags(db.DB_LOG_AUTO_REMOVE, 1) else: # Python 2.6 log settings (db version 4.7.25) self.env.log_set_config(db.DB_LOG_AUTO_REMOVE, 1) + # The DB_PRIVATE flag must go if we ever move to multi-user setup env_flags = db.DB_CREATE | db.DB_PRIVATE |\ db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\ @@ -1908,9 +1915,14 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): # These env settings are only needed for Txn environment self.env.set_lk_max_locks(25000) self.env.set_lk_max_objects(25000) - if db.version() < (4, 7): - # Python 2.5 log settings - self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1) # clean up unused logs + if sys.version_info < (2, 6): + if db.version() < (4, 7): + # Python 2.5 log settings + # clean up unused logs + self.env.set_flags(db.DB_LOG_AUTOREMOVE, 1) + else: + # Python 2.5.2, DB 4.7.25 uses set_flags, too + self.env.set_flags(db.DB_LOG_AUTO_REMOVE, 1) else: # Python 2.6 log settings (db version 4.7.25) self.env.log_set_config(db.DB_LOG_AUTO_REMOVE, 1)