Make construction variables with a value of 0 work (Anthony Roach)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 21 Mar 2002 18:24:13 +0000 (18:24 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 21 Mar 2002 18:24:13 +0000 (18:24 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@300 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Util.py
src/engine/SCons/UtilTests.py

index 70ba009341f06f788c10f9a16910d76770deec7d..97ac3137edd581e098b5674360969b882b31350f 100644 (file)
 
 RELEASE 0.06 - 
 
+  From Anthony Roach:
+
+  - Fix:  Construction variables with values of 0 were incorrectly
+    interpolated as ''. 
+
   From Charles Crain:
 
   - Fix command generators to expand construction variables.
index 04e7e7d9b70a8efaf9a65593c2cb3082369f06b2..3fb56d969d727e7a2d4091e7eaf06e120dc1b6b9 100644 (file)
@@ -195,7 +195,7 @@ def scons_subst_list(strSubst, globals, locals, remove=None):
             key = key[1:-1]
        try:
             e = eval(key, globals, locals)
-            if not e:
+            if e is None:
                 s = ''
             elif is_List(e):
                 s = string.join(map(str, e), '\0')
index f3569f054e1b7bb11ac69f885bff270bf1b5ee39..40553eeae3632640ab54e388394bc126e3d6e15c 100644 (file)
@@ -98,6 +98,8 @@ class UtilTestCase(unittest.TestCase):
                                                           "/bar/ack.cpp",
                                                           "../foo/ack.c" ]))
         loc['xxx'] = None
+        loc['zero'] = 0
+        loc['one'] = 1
 
         if os.sep == '/':
             def cvt(str):
@@ -152,6 +154,12 @@ class UtilTestCase(unittest.TestCase):
         newcom = scons_subst("test $( $xxx $)", loc, {}, re.compile('\$[()]'))
         assert newcom == cvt("test"), newcom
 
+        newcom = scons_subst("test $zero", loc, {})
+        assert newcom == cvt("test 0"), newcom
+
+        newcom = scons_subst("test $one", loc, {})
+        assert newcom == cvt("test 1"), newcom
+
         newcom = scons_subst("test aXbXcXd", loc, {}, re.compile('X'))
         assert newcom == cvt("test abcd"), newcom