diff options
author | Steven Knight <knight@baldmt.com> | 2002-03-21 18:24:13 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-03-21 18:24:13 (GMT) |
commit | d3dc04b8b7031da1a83f752aa77e23e0919512e5 (patch) | |
tree | ecf8aa5acbdab3b7f2ba8a5381b794fad2930406 /src | |
parent | bb8376994ade0355161d82068d420dee2ff4bec3 (diff) | |
download | SCons-d3dc04b8b7031da1a83f752aa77e23e0919512e5.zip SCons-d3dc04b8b7031da1a83f752aa77e23e0919512e5.tar.gz SCons-d3dc04b8b7031da1a83f752aa77e23e0919512e5.tar.bz2 |
Make construction variables with a value of 0 work (Anthony Roach)
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 5 | ||||
-rw-r--r-- | src/engine/SCons/Util.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/UtilTests.py | 8 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 70ba009..97ac313 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -10,6 +10,11 @@ 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. diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 04e7e7d..3fb56d9 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -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') diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index f3569f0..40553ee 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -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 |