diff options
author | Steven Knight <knight@baldmt.com> | 2010-08-21 00:20:59 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2010-08-21 00:20:59 (GMT) |
commit | 262d85eeb5f1fafe66c2513d4e950978214d67c5 (patch) | |
tree | d7ee0b93937798b149cf11b5e651275255db6397 /src | |
parent | 8276c7774f1d238da7b4fc1f241741d2203bac10 (diff) | |
download | SCons-262d85eeb5f1fafe66c2513d4e950978214d67c5.zip SCons-262d85eeb5f1fafe66c2513d4e950978214d67c5.tar.gz SCons-262d85eeb5f1fafe66c2513d4e950978214d67c5.tar.bz2 |
Add tests of using SConsignFile() with Python dbm modules.
Related fixes: explicitly close the db when we close it,
and add a .close() method to dblite.py.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/SConsign.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/dblite.py | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/engine/SCons/SConsign.py b/src/engine/SCons/SConsign.py index 41125c5..6555fcb 100644 --- a/src/engine/SCons/SConsign.py +++ b/src/engine/SCons/SConsign.py @@ -104,9 +104,15 @@ def write(): try: syncmethod = db.sync except AttributeError: - pass # Not all anydbm modules have sync() methods. + pass # Not all dbm modules have sync() methods. else: syncmethod() + try: + closemethod = db.close + except AttributeError: + pass # Not all dbm modules have close() methods. + else: + closemethod() class SConsignEntry(object): """ diff --git a/src/engine/SCons/dblite.py b/src/engine/SCons/dblite.py index ea24e6a..f4ba90a 100644 --- a/src/engine/SCons/dblite.py +++ b/src/engine/SCons/dblite.py @@ -104,10 +104,13 @@ class dblite(object): if (ignore_corrupt_dbfiles == 1): corruption_warning(self._file_name) - def __del__(self): + def close(self): if (self._needs_sync): self.sync() + def __del__(self): + self.close() + def sync(self): self._check_writable() f = self._open(self._tmp_name, "wb", self._mode) |