- Check out CVS source files using POSIX path names (forward slashes
as separators) even on Win32.
+ - Add Node.clear() and Node.FS.Entry.clear() methods to wipe out a
+ Node's state, allowing it to be re-evaluated by continuous
+ integration build interfaces.
+
RELEASE 0.13 - Mon, 31 Mar 2003 20:22:00 -0600
self.cwd = None # will hold the SConscript directory for target nodes
self.duplicate = directory.duplicate
+ def clear(self):
+ """Completely clear an Entry of all its cached state (so that it
+ can be re-evaluated by interfaces that do continuous integration
+ builds).
+ """
+ SCons.Node.Node.clear(self)
+ try:
+ delattr(self, '_exists')
+ except AttributeError:
+ pass
+ try:
+ delattr(self, '_rexists')
+ except AttributeError:
+ pass
+
def get_dir(self):
return self.dir
SCons.Warnings.warningAsException(old_warn_exceptions)
SCons.Warnings.suppressWarningClass(SCons.Warnings.CacheWriteErrorWarning)
+class clearTestCase(unittest.TestCase):
+ def runTest(self):
+ fs = SCons.Node.FS.FS()
+
+ e = fs.Entry('e')
+ e._exists = 1
+ e._rexists = 1
+ e.clear()
+ assert not hasattr(e, '_exists')
+ assert not hasattr(e, '_rexists')
+
+ d = fs.Dir('d')
+ d._exists = 1
+ d._rexists = 1
+ d.clear()
+ assert not hasattr(d, '_exists')
+ assert not hasattr(d, '_rexists')
+
+ f = fs.File('f')
+ f._exists = 1
+ f._rexists = 1
+ f.clear()
+ assert not hasattr(f, '_exists')
+ assert not hasattr(f, '_rexists')
+
if __name__ == "__main__":
suite.addTest(get_actionsTestCase())
suite.addTest(SConstruct_dirTestCase())
suite.addTest(CacheDirTestCase())
+ suite.addTest(clearTestCase())
if not unittest.TextTestRunner().run(suite).wasSuccessful():
sys.exit(1)
finally:
SCons.Node.Annotate = save_Annotate
+ def test_clear(self):
+ """Test clearing all cached state information."""
+ n = SCons.Node.Node()
+
+ n.set_state(3)
+ n.set_bsig('bsig')
+ n.set_csig('csig')
+ n.includes = 'testincludes'
+ n.found_include = {'testkey':'testvalue'}
+ n.implicit = 'testimplicit'
+
+ n.clear()
+
+ assert n.get_state() is None, n.get_state()
+ assert not hasattr(n, 'bsig'), n.bsig
+ assert not hasattr(n, 'csig'), n.csig
+ assert n.includes is None, n.includes
+ assert n.found_includes == {}, n.found_includes
+ assert n.implicit is None, n.implicit
+
if __name__ == "__main__":
suite = unittest.makeSuite(NodeTestCase, 'test_')
# node were presumably just changed:
self.del_csig()
+ def clear(self):
+ """Completely clear a Node of all its cached state (so that it
+ can be re-evaluated by interfaces that do continuous integration
+ builds).
+ """
+ self.set_state(None)
+ self.del_bsig()
+ self.del_csig()
+ self.includes = None
+ self.found_includes = {}
+ self.implicit = None
+
def visited(self):
"""Called just after this node has been visited
without requiring a build.."""