From 0f589777dc52f0b55ed0e1865ed1930fc987e305 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Thu, 8 Sep 2005 10:58:55 +0000 Subject: test --- src/engine/SCons/Util.py | 5 +---- src/engine/SCons/UtilTests.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 2859807..1731655 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -546,12 +546,11 @@ _regex_remove = [ _rm, None, _remove ] # # " " [white space] # "non-white-space" [without any dollar signs] -# '"with-space-or-not"' [without any dollar signs] # "$" [single dollar sign] # _dollar_exps_str = r'\$[\$\(\)]|\$[_a-zA-Z][\.\w]*|\${[^}]*}' _dollar_exps = re.compile(r'(%s)' % _dollar_exps_str) -_separate_args = re.compile(r'(%s|\s+|[^"\s\$]+|"[^"\$]+"|\$)' % _dollar_exps_str) +_separate_args = re.compile(r'(%s|\s+|[^\s\$]+|\$)' % _dollar_exps_str) # This regular expression is used to replace strings of multiple white # space characters in the string result from the scons_subst() function. @@ -891,8 +890,6 @@ def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, gv else: self.next_word() else: - if a[0] == '"' and a[-1] == '"': - a = a[1:-1] self.expand(a, lvars, within_list) else: self.expand(args, lvars, within_list) diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index 19ec748..b20ff62 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -535,6 +535,15 @@ class UtilTestCase(unittest.TestCase): MyNode("/bar/ack.cpp"), MyNode("../foo/ack.c") ] + def _defines(defs): + l = [] + for d in defs: + if SCons.Util.is_List(d) or type(d) is types.TupleType: + l.append(str(d[0]) + '=' + str(d[1])) + else: + l.append(str(d)) + return l + loc = { 'xxx' : None, 'NEWLINE' : 'before\nafter', @@ -586,6 +595,9 @@ class UtilTestCase(unittest.TestCase): # Test callable objects that don't match our calling arguments. 'CALLABLE' : TestCallable('callable-2'), + + '_defines' : _defines, + 'DEFS' : [ ('Q1', '"q1"'), ('Q2', '"$AAA"') ], } env = DummyEnv(loc) @@ -721,8 +733,13 @@ class UtilTestCase(unittest.TestCase): # Test callables that don't match our calling arguments. '$CALLABLE', [['callable-2']], + # Test + # Test handling of quotes. - 'aaa "bbb ccc" ddd', [['aaa', 'bbb ccc', 'ddd']], + # XXX Find a way to handle this in the future. + #'aaa "bbb ccc" ddd', [['aaa', 'bbb ccc', 'ddd']], + + '${_defines(DEFS)}', [['Q1="q1"', 'Q2="a"']], ] gvars = env.Dictionary() -- cgit v0.12