Anonymous avatar Anonymous committed e883b2e

Have SCons report when something is up-to-date.

Comments (0)

Files changed (3)

 
 import os
 import os.path
+import string
 import TestCmd
 
 class TestFailed(Exception):
 	    print "Actual STDERR ============"
 	    print self.stderr()
 	    raise TestFailed
+
+    def up_to_date(self, arguments = None, **kw):
+	    kw['arguments'] = arguments
+	    s = ""
+	    for arg in string.split(arguments):
+		s = s + 'scons: "%s" is up to date.\n' % arg
+	    kw['stdout'] = s
+	    apply(self.run, [], kw)

src/script/scons.py

     if not targets:
 	targets = default_targets
 
+    # XXX Right now, this next block prints all "up to date" messages
+    # first, and then goes through and builds the other nodes:
+    #
+    #		$ scons aaa bbb ccc ddd
+    #		scons: "aaa" is up to date.
+    #		scons: "ccc" is up to date.
+    #		cc -o bbb bbb.c
+    #		cc -o ddd ddd.c
+    #
+    # When we get the real Task and Taskmaster classes, this should
+    # be changed to interact with the engine to deal with targets in
+    # the same order as specified:
+    #
+    #		$ scons aaa bbb ccc ddd
+    #		scons: "aaa" is up to date.
+    #		cc -o bbb bbb.c
+    #		scons: "ccc" is up to date.
+    #		cc -o ddd ddd.c
+    #
     calc = SCons.Sig.Calculator(SCons.Sig.MD5)
-    nodes = map(lambda x: SCons.Node.FS.default_fs.File(x), targets)
-    nodes = filter(lambda x, calc=calc: not calc.current(x), nodes)
+    nodes = []
+    for t in map(lambda x: SCons.Node.FS.default_fs.File(x), targets):
+	if calc.current(t):
+	    print 'scons: "%s" is up to date.' % t.path
+	else:
+	    nodes.append(t)
     
     taskmaster = Taskmaster(nodes)
 
 #XXXtest.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c\nf3c.c\n")
 
 #XXXtest.up_to_date(arguments = '.')
+test.up_to_date(arguments = 'foo1 foo2')
 
 test.write('f1.c', """
 int
 #XXXtest.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c X\nf3c.c\n")
 
 #XXXtest.up_to_date(arguments = '.')
+test.up_to_date(arguments = 'foo1 foo2')
 
 # make sure the programs don't get rebuilt, because nothing changed:
 oldtime1 = os.path.getmtime(test.workpath('foo1'))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.