Evaluate Action varlists when calculating signatures. (Steve Christensen)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 27 Apr 2003 04:37:44 +0000 (04:37 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 27 Apr 2003 04:37:44 +0000 (04:37 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@662 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Action.py
src/engine/SCons/ActionTests.py

index b77f6a10ce7a9555c22a5a311a1c8ad2e3d27e6a..7320827c5c52a6063c3a3f31953cad06e5b6ef95 100644 (file)
@@ -38,6 +38,9 @@ RELEASE 0.14 - XXX
   - Add an optional sort function argument to the GenerateHelpText()
     Options function.
 
+  - Evaluate the "varlist" variables when computing the signature of a
+    function action.
+
   From Charles Crain:
 
   - Parse the source .java files for class names (including inner class
index 9ad925afa5132bc27c2d0ab8e6d54a52eb1918f3..764d5279b25aacbe900889b90f5753f9e608a614 100644 (file)
@@ -402,8 +402,8 @@ class FunctionAction(ActionBase):
         except:
             # "self.execfunction" is a callable object.
             code = self.execfunction.__call__.im_func.func_code.co_code
-        return str(code) + string.join(map(lambda v, e=env: str(e[v]),
-                                       self.varlist))
+        return str(code) + env.subst(string.join(map(lambda v: '${'+v+'}',
+                                                     self.varlist)))
 
 class ListAction(ActionBase):
     """Class for lists of other actions."""
index fb77fe6c4232a27323b434742aafa1c2f5957d48..9189b4cf01fddfc9e8ca8770f3479ddfd42d62b4 100644 (file)
@@ -93,7 +93,10 @@ class Environment:
             return s
         try:
             if s[0] == '$':
-                return self.d.get(s[1:], '')
+                if s[1] == '{':
+                    return self.d.get(s[2:-1], '')
+                else:
+                    return self.d.get(s[1:], '')
         except IndexError:
             pass
         return self.d.get(s, s)
@@ -844,6 +847,12 @@ class FunctionActionTestCase(unittest.TestCase):
         c = a.get_contents(target=[], source=[], env=Environment())
         assert c == "\177\036\000\177\037\000d\000\000S", repr(c)
 
+        a = SCons.Action.FunctionAction(Func, varlist=['XYZ'])
+        c = a.get_contents(target=[], source=[], env=Environment())
+        assert c == "\177\036\000\177\037\000d\000\000S", repr(c)
+        c = a.get_contents(target=[], source=[], env=Environment(XYZ = 'foo'))
+        assert c == "\177\036\000\177\037\000d\000\000Sfoo", repr(c)
+
 class ListActionTestCase(unittest.TestCase):
 
     def test_init(self):