From 21d7c949199a57b317215f92595742ea55c2e5b9 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sat, 20 Aug 2005 12:44:02 +0000 Subject: [PATCH] Handle files with white space when in temporary files. (Stanislav Baranov) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1338 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Util.py | 5 ++++- src/engine/SCons/UtilTests.py | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index a4516e9f..084975a9 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -546,11 +546,12 @@ _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. @@ -890,6 +891,8 @@ 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 62360383..ce9fd560 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -325,6 +325,9 @@ class UtilTestCase(unittest.TestCase): # Tests callables that don't match our calling arguments. '$CALLABLE', 'callable-1', + + # Test handling of quotes. + 'aaa "bbb ccc" ddd', 'aaa "bbb ccc" ddd', ] kwargs = {'target' : target, 'source' : source, @@ -717,6 +720,9 @@ class UtilTestCase(unittest.TestCase): # Test callables that don't match our calling arguments. '$CALLABLE', [['callable-2']], + + # Test handling of quotes. + 'aaa "bbb ccc" ddd', [['aaa', 'bbb ccc', 'ddd']], ] gvars = env.Dictionary() -- 2.26.2