From d7277461dea648eb68c98d6583e9ae9459b16101 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Wed, 10 Nov 2004 02:37:58 +0000 Subject: [PATCH] Add a genstring() method to the ListAction class. git-svn-id: http://scons.tigris.org/svn/scons/trunk@1152 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Action.py | 6 ++++++ src/engine/SCons/ActionTests.py | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 5f89cc2b..3b62702b 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -575,6 +575,12 @@ class ListAction(ActionBase): return Action(x) self.list = map(list_of_actions, list) + def genstring(self, target, source, env): + return string.join(map(lambda a, t=target, s=source, e=env: + a.genstring(t, s, e), + self.list), + '\n') + def __str__(self): return string.join(map(str, self.list), '\n') diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index e996f61c..74812df4 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -1408,11 +1408,12 @@ class ListActionTestCase(unittest.TestCase): """ def f(target,source,env): pass - def g(target,source,env): - pass + def g(target,source,env,for_signature): + return 'generated %s %s' % (target[0], source[0]) + g = SCons.Action.CommandGenerator(g) a = SCons.Action.ListAction([f, g, "XXX", f]) - s = a.genstring([], [], Environment()) - assert s == "f(target, source, env)\ng(target, source, env)\nXXX\nf(target, source, env)", s + s = a.genstring(['foo.x'], ['bar.y'], Environment()) + assert s == "f(target, source, env)\ngenerated foo.x bar.y\nXXX\nf(target, source, env)", s def test_execute(self): """Test executing a list of subsidiary Actions -- 2.26.2