SetBuildSignatureType(), SetContentSignatureType(), SetJobs() and
GetJobs() global functions (deprecated in 0.14).
+ - Fix problems with corrupting the .sconsign.dblite file when
+ interrupting builds by writing to a temporary file and renaming,
+ not writing the file directly.
+
From Gary Oberbrunner:
- Add an Environment.Dump() method to print the contents of a
import time
import shutil
import os
+import os.path
import types
import __builtin__
except NameError:
def unicode(s): return s
+dblite_suffix = '.dblite'
+tmp_suffix = '.tmp'
+
class dblite:
def __init__(self, file_base_name, flag, mode):
assert flag in (None, "r", "w", "c", "n")
if (flag is None): flag = "r"
- if file_base_name[-7:] != '.dblite':
- file_base_name = file_base_name + '.dblite'
- self._file_name = file_base_name
+ base, ext = os.path.splitext(file_base_name)
+ if ext == dblite_suffix:
+ # There's already a suffix on the file name, don't add one.
+ self._file_name = file_base_name
+ self._tmp_name = base + tmp_suffix
+ else:
+ self._file_name = file_base_name + dblite_suffix
+ self._tmp_name = file_base_name + tmp_suffix
self._flag = flag
self._mode = mode
self._dict = {}
def sync(self):
self._check_writable()
- f = _open(self._file_name, "wb", self._mode)
+ f = _open(self._tmp_name, "wb", self._mode)
cPickle.dump(self._dict, f, 1)
f.close()
+ os.rename(self._tmp_name, self._file_name)
self._needs_sync = 00000
if (keep_all_files):
shutil.copyfile(