Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: build/copy_test_data_ios.py

Issue 11293198: Fix handling of spaces with paths in copy_test_data.py (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/copy_test_data_ios.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/copy_test_data_ios.py
diff --git a/build/copy_test_data_ios.py b/build/copy_test_data_ios.py
index d785f2675854c69f0a1d77cf7d347f7c6b2e9c40..6f0302f9506e0471aeaec7852af12dcddc30f0a9 100755
--- a/build/copy_test_data_ios.py
+++ b/build/copy_test_data_ios.py
@@ -13,6 +13,10 @@ import sys
class WrongNumberOfArgumentsException(Exception):
pass
+def EscapePath(path):
+ """Returns a path with spaces escaped."""
+ return path.replace(" ", "\\ ")
+
def ListFilesForPath(path):
"""Returns a list of all the files under a given path."""
output = []
@@ -36,13 +40,10 @@ def ListFilesForPath(path):
def CalcInputs(inputs):
"""Computes the full list of input files for a set of command-line arguments.
"""
- # |inputs| is a list of strings, each of which may contain muliple paths
- # separated by spaces.
+ # |inputs| is a list of paths, which may be directories.
output = []
for input in inputs:
- tokens = input.split()
- for token in tokens:
- output.extend(ListFilesForPath(token))
+ output.extend(ListFilesForPath(input))
return output
def CopyFiles(relative_filenames, output_basedir):
@@ -76,14 +77,15 @@ def DoMain(argv):
raise WrongNumberOfArgumentsException('<input_files> required.')
files_to_copy = CalcInputs(arglist)
+ escaped_files = [EscapePath(x) for x in CalcInputs(arglist)]
if options.list_inputs:
- return '\n'.join(files_to_copy)
+ return '\n'.join(escaped_files)
if not options.output_dir:
raise WrongNumberOfArgumentsException('-o required.')
if options.list_outputs:
- outputs = [os.path.join(options.output_dir, x) for x in files_to_copy]
+ outputs = [os.path.join(options.output_dir, x) for x in escaped_files]
return '\n'.join(outputs)
CopyFiles(files_to_copy, options.output_dir)
« no previous file with comments | « build/copy_test_data_ios.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698