diff options
author | Steven Knight <knight@baldmt.com> | 2002-08-09 20:58:20 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-08-09 20:58:20 (GMT) |
commit | 1276260fda5a332d8433a6caa2dfa31871ac50d5 (patch) | |
tree | aa82529a6469e056fb0a651b7cad63c4adfdf2cd | |
parent | cf339c049d817d154d838b65808889720f589a04 (diff) | |
download | SCons-1276260fda5a332d8433a6caa2dfa31871ac50d5.zip SCons-1276260fda5a332d8433a6caa2dfa31871ac50d5.tar.gz SCons-1276260fda5a332d8433a6caa2dfa31871ac50d5.tar.bz2 |
Fix aliases as dependencies. (Anthony Roach)
-rw-r--r-- | src/CHANGES.txt | 3 | ||||
-rw-r--r-- | src/engine/SCons/Node/Alias.py | 16 | ||||
-rw-r--r-- | test/Alias.py | 43 |
3 files changed, 53 insertions, 9 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a4d91fc..4902256 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -26,6 +26,9 @@ RELEASE 0.09 - - Issue a warning and continue when finding a corrupt .sconsign file. + - Fix using an alias as a dependency of a target so that if one of the + alias' dependencies gets rebuilt, the resulting target will, too. + RELEASE 0.08 - Mon, 15 Jul 2002 12:08:51 -0500 diff --git a/src/engine/SCons/Node/Alias.py b/src/engine/SCons/Node/Alias.py index 276750f..f2c8f34 100644 --- a/src/engine/SCons/Node/Alias.py +++ b/src/engine/SCons/Node/Alias.py @@ -63,14 +63,6 @@ class Alias(SCons.Node.Node): """A "builder" for aliases.""" pass - def set_bsig(self, bsig): - """An alias has no signature.""" - self.bsig = None - - def set_csig(self, csig): - """An alias has no signature.""" - self.csig = None - def current(self, calc): """If all of our children were up-to-date, then this Alias was up-to-date, too.""" @@ -95,6 +87,14 @@ class Alias(SCons.Node.Node): # what directory scons was run from. Alias nodes # are outside the filesystem: return 1 + + def get_contents(self): + """The contents of an alias is the concatenation + of all the contents of its sources""" + contents = "" + for kid in self.children(None): + contents = contents + kid.get_contents() + return contents default_ans = AliasNameSpace() diff --git a/test/Alias.py b/test/Alias.py index aff9c2a..ca9075f 100644 --- a/test/Alias.py +++ b/test/Alias.py @@ -27,10 +27,11 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import sys import TestSCons +import TestCmd python = sys.executable -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match=TestCmd.match_re) test.subdir('sub1', 'sub2') @@ -117,4 +118,44 @@ test.run(arguments = 'blat') test.fail_test(not os.path.exists(test.workpath('f2.out'))) test.fail_test(not os.path.exists(test.workpath('f3.out'))) +test.write('f3.in', "f3.in 2 \n") + +test.run(arguments = 'f1.out', stdout=""".* build.py f3.out f3.in +.* build.py f1.out f1.in +""") + +test.up_to_date(arguments = 'f1.out') + +test.write('SConstruct', """ +SetBuildSignatureType('content') +B = Builder(action = r"%s build.py $TARGET $SOURCES") +env = Environment() +env['BUILDERS']['B'] = B +env.B(target = 'f1.out', source = 'f1.in') +env.B(target = 'f2.out', source = 'f2.in') +env.B(target = 'f3.out', source = 'f3.in') +SConscript('sub1/SConscript', "env") +SConscript('sub2/SConscript', "env") +env.Alias('foo', ['f2.out', 'sub1']) +env.Alias('bar', ['sub2', 'f3.out']) +env.Alias('blat', ['sub2', 'f3.out']) +env.Alias('blat', ['f2.out', 'sub1']) +env.Depends('f1.out', 'bar') +""" % python) + +os.unlink(test.workpath('f1.out')) + +test.run(arguments = 'f1.out') + +test.fail_test(not os.path.exists(test.workpath('f1.out'))) + +test.write('f3.in', "f3.in 3 \n") + +test.run(arguments = 'f1.out', stdout=""".* build.py f3.out f3.in +.* build.py f1.out f1.in +""") + +test.up_to_date(arguments = 'f1.out') + + test.pass_test() |