check for the build engine in the parent directory of the Python
library directory (/usr/lib64 instead of /usr/lib).
+ From Stephen Kennedy:
+
+ - Speed up writing the .sconsign file at the end of a run by only
+ calling sync() once at the end, not after every entry.
+
From Steven Knight:
- When compiling with Microsoft Visual Studio, don't include the ATL and
def write():
global sig_files
for sig_file in sig_files:
- sig_file.write()
+ sig_file.write(sync=0)
+ if database:
+ try:
+ syncmethod = database.sync
+ except AttributeError:
+ pass # Not all anydbm modules have sync() methods.
+ else:
+ syncmethod()
class Base:
"""
global sig_files
sig_files.append(self)
- def write(self):
+ def write(self, sync=1):
if self.dirty:
global database
database[self.dir.path] = cPickle.dumps(self.entries, 1)
- try:
- database.sync()
- except AttributeError:
- # Not all anydbm modules have sync() methods.
- pass
+ if sync:
+ try:
+ syncmethod = database.sync
+ except AttributeError:
+ # Not all anydbm modules have sync() methods.
+ pass
+ else:
+ syncmethod()
class Dir(Base):
def __init__(self, fp=None, module=None):
global sig_files
sig_files.append(self)
- def write(self):
+ def write(self, sync=1):
"""
Write the .sconsign file to disk.
def __init__(self, name):
self.name = name
+class DummyModule:
+ def to_string(self, sig):
+ return str(sig)
+
+ def from_string(self, sig):
+ return int(sig)
+
class BaseTestCase(unittest.TestCase):
def runTest(self):
- class DummyModule:
- def to_string(self, sig):
- return str(sig)
-
- def from_string(self, sig):
- return int(sig)
-
class DummyNode:
path = 'not_a_valid_path'
class SConsignDirFileTestCase(unittest.TestCase):
def runTest(self):
- class DummyModule:
- def to_string(self, sig):
- return str(sig)
-
- def from_string(self, sig):
- return int(sig)
-
class DummyNode:
path = 'not_a_valid_path'
assert fake_dbm.mode == "c", fake_dbm.mode
+class writeTestCase(unittest.TestCase):
+
+ def runTest(self):
+
+ class DummyNode:
+ path = 'not_a_valid_path'
+
+ test = TestCmd.TestCmd(workdir = '')
+ file = test.workpath('sconsign_file')
+
+ class Fake_DBM:
+ def __setitem__(self, key, value):
+ pass
+ def open(self, name, mode):
+ self.sync_count = 0
+ return self
+ def sync(self):
+ self.sync_count = self.sync_count + 1
+
+ fake_dbm = Fake_DBM()
+
+ SCons.SConsign.database = None
+ SCons.SConsign.File(file, fake_dbm)
+
+ f = SCons.SConsign.DirFile(DummyNode(), DummyModule())
+
+ f.set_entry('foo', BuildInfo('foo'))
+ f.set_entry('bar', BuildInfo('bar'))
+
+ SCons.SConsign.write()
+
+ assert fake_dbm.sync_count == 1, fake_dbm.sync_count
+
def suite():
suite = unittest.TestSuite()
suite.addTest(SConsignDBTestCase())
suite.addTest(SConsignDirFileTestCase())
suite.addTest(SConsignFileTestCase())
+ suite.addTest(writeTestCase())
return suite
if __name__ == "__main__":