Anonymous avatar Anonymous committed 0015348

Handle files with white space when in temporary files. (Stanislav Baranov)

Comments (0)

Files changed (2)

src/engine/SCons/Util.py

 #
 #       "   "                   [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.
                         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)

src/engine/SCons/UtilTests.py

 
             # 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,
 
             # 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()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.