Handle files with white space when in temporary files. (Stanislav Baranov)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 20 Aug 2005 12:44:02 +0000 (12:44 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 20 Aug 2005 12:44:02 +0000 (12:44 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1338 fdb21ef1-2011-0410-befe-b5e4ea1792b1

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

index a4516e9f9932fd9053a0f61885c78474c57de76a..084975a9846444f786939b6aeb2fef0a71f2ec7e 100644 (file)
@@ -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)
index 623603835d8b5c1508baf59f95690ce34c31c4e3..ce9fd5600f4f01444229bbd7fb031516f4b3b515 100644 (file)
@@ -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()