summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-07-21 13:44:04 (GMT)
committerSteven Knight <knight@baldmt.com>2003-07-21 13:44:04 (GMT)
commit78c4fae66e565b081bfadd947c2fc9466c57ec03 (patch)
tree271ebb383c81ef5f176d4e76bcae840feb1c432f
parentd77bd9aa09a469f734d52951f09ec8b649d33482 (diff)
downloadSCons-78c4fae66e565b081bfadd947c2fc9466c57ec03.zip
SCons-78c4fae66e565b081bfadd947c2fc9466c57ec03.tar.gz
SCons-78c4fae66e565b081bfadd947c2fc9466c57ec03.tar.bz2
Give Value Nodes timestamps. (Chad Austin)
-rw-r--r--doc/man/scons.13
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Node/Python.py5
-rw-r--r--test/Value.py120
4 files changed, 80 insertions, 51 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index 7be2a37..b39db93 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -4588,7 +4588,8 @@ calling
.BR str( value )
changes between SCons runs, any targets depending on
.BR Value( value )
-will be rebuilt.
+will be rebuilt. When using timestamp source signatures, Value nodes'
+timestamps are equal to the system time when the node is created.
.ES
def create(target, source, env):
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index b7a0506..abbf744 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -14,6 +14,9 @@ RELEASE 0.XX - XXX
- Support specifying a list of tools when calling Environment.Copy().
+ - Give a Value Nodes a timestamp of the system time when they're
+ created, so they'll work when using timestamp-based signatures.
+
From Steven Knight:
- Tighten up the scons -H help output.
diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py
index 9348b83..312be5c 100644
--- a/src/engine/SCons/Node/Python.py
+++ b/src/engine/SCons/Node/Python.py
@@ -30,6 +30,7 @@ Python nodes.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import SCons.Node
+import time
class Value(SCons.Node.Node):
"""A class for Python variables, typically passed on the command line
@@ -38,6 +39,7 @@ class Value(SCons.Node.Node):
def __init__(self, value):
SCons.Node.Node.__init__(self)
self.value = value
+ self.timestamp = time.time()
def __str__(self):
return repr(self.value)
@@ -74,3 +76,6 @@ class Value(SCons.Node.Node):
for kid in self.children(None):
contents = contents + kid.get_contents()
return contents
+
+ def get_timestamp(self):
+ return self.timestamp
diff --git a/test/Value.py b/test/Value.py
index f3df6fe..11fb72a 100644
--- a/test/Value.py
+++ b/test/Value.py
@@ -33,7 +33,13 @@ import TestCmd
test = TestSCons.TestSCons(match=TestCmd.match_re)
-test.write('SConstruct', """
+for source_signature in ['MD5', 'timestamp']:
+
+ print "Testing Value node with source signatures:", source_signature
+
+ test.write('SConstruct', """
+SourceSignatures(r'%s')
+
class Custom:
def __init__(self, value): self.value = value
def __str__(self): return "C=" + str(self.value)
@@ -50,54 +56,68 @@ env['BUILDERS']['B'] = Builder(action = create)
env.B('f1.out', Value(P))
env.B('f2.out', Value(L))
env.B('f3.out', Value(C))
-""")
-
-
-test.run()
-out1 = """create("f1.out", "'/usr/local'")"""
-out2 = """create("f2.out", "10")"""
-out3 = """create\\("f3.out", "<.*.Custom instance at """
-test.fail_test(string.find(test.stdout(), out1) == -1)
-test.fail_test(string.find(test.stdout(), out2) == -1)
-test.fail_test(re.search(out3, test.stdout()) == None)
-
-test.fail_test(not os.path.exists(test.workpath('f1.out')))
-test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr/local')
-test.fail_test(not os.path.exists(test.workpath('f2.out')))
-test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '10')
-test.fail_test(not os.path.exists(test.workpath('f3.out')))
-test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr/local')
-
-test.up_to_date(arguments = ".")
-
-test.run(arguments = 'prefix=/usr')
-out4 = """create("f1.out", "'/usr'")"""
-out5 = """create("f2.out", "4")"""
-out6 = """create\\("f3.out", "<.*.Custom instance at """
-test.fail_test(string.find(test.stdout(), out4) == -1)
-test.fail_test(string.find(test.stdout(), out5) == -1)
-test.fail_test(re.search(out6, test.stdout()) == None)
-
-test.fail_test(not os.path.exists(test.workpath('f1.out')))
-test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr')
-test.fail_test(not os.path.exists(test.workpath('f2.out')))
-test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
-test.fail_test(not os.path.exists(test.workpath('f3.out')))
-test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr')
-
-test.unlink('f3.out')
-
-test.run(arguments = 'prefix=/var')
-out4 = """create("f1.out", "'/var'")"""
-test.fail_test(string.find(test.stdout(), out4) == -1)
-test.fail_test(string.find(test.stdout(), out5) != -1)
-test.fail_test(re.search(out6, test.stdout()) == None)
-
-test.fail_test(not os.path.exists(test.workpath('f1.out')))
-test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/var')
-test.fail_test(not os.path.exists(test.workpath('f2.out')))
-test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
-test.fail_test(not os.path.exists(test.workpath('f3.out')))
-test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/var')
+""" % source_signature)
+
+ test.run(arguments='-c')
+ test.run()
+
+ out1 = """create("f1.out", "'/usr/local'")"""
+ out2 = """create("f2.out", "10")"""
+ out3 = """create\\("f3.out", "<.*.Custom instance at """
+ #" <- unconfuses emacs syntax highlighting
+ test.fail_test(string.find(test.stdout(), out1) == -1)
+ test.fail_test(string.find(test.stdout(), out2) == -1)
+ test.fail_test(re.search(out3, test.stdout()) == None)
+
+ test.fail_test(not os.path.exists(test.workpath('f1.out')))
+ test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr/local')
+ test.fail_test(not os.path.exists(test.workpath('f2.out')))
+ test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '10')
+ test.fail_test(not os.path.exists(test.workpath('f3.out')))
+ test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr/local')
+
+ if source_signature == 'MD5':
+ test.up_to_date(arguments='.')
+
+ test.run(arguments='prefix=/usr')
+ out4 = """create("f1.out", "'/usr'")"""
+ out5 = """create("f2.out", "4")"""
+ out6 = """create\\("f3.out", "<.*.Custom instance at """
+ #" <- unconfuses emacs syntax highlighting
+ test.fail_test(string.find(test.stdout(), out4) == -1)
+ test.fail_test(string.find(test.stdout(), out5) == -1)
+ test.fail_test(re.search(out6, test.stdout()) == None)
+
+ test.fail_test(not os.path.exists(test.workpath('f1.out')))
+ test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr')
+ test.fail_test(not os.path.exists(test.workpath('f2.out')))
+ test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
+ test.fail_test(not os.path.exists(test.workpath('f3.out')))
+ test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr')
+
+ if source_signature == 'MD5':
+ test.up_to_date('prefix=/usr', '.')
+
+ test.unlink('f3.out')
+
+ test.run(arguments='prefix=/var')
+ out4 = """create("f1.out", "'/var'")"""
+
+ test.fail_test(string.find(test.stdout(), out4) == -1)
+ if source_signature == 'MD5':
+ test.fail_test(string.find(test.stdout(), out5) != -1)
+ else:
+ test.fail_test(string.find(test.stdout(), out5) == -1)
+ test.fail_test(re.search(out6, test.stdout()) == None)
+
+ if source_signature == 'MD5':
+ test.up_to_date('prefix=/var', '.')
+
+ test.fail_test(not os.path.exists(test.workpath('f1.out')))
+ test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/var')
+ test.fail_test(not os.path.exists(test.workpath('f2.out')))
+ test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
+ test.fail_test(not os.path.exists(test.workpath('f3.out')))
+ test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/var')
test.pass_test()