diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 18:04:50 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 18:04:50 +0000 |
commit | 92bba2412ff81813ab7f6809da9e7b542127e8b5 (patch) | |
tree | 772f21b18d3615178cf92b0e989c2bd2517301b7 /build/copy_test_data_ios.py | |
parent | 0307006a55e425b8d5876de52d4266e416f88cda (diff) | |
download | chromium_src-92bba2412ff81813ab7f6809da9e7b542127e8b5.zip chromium_src-92bba2412ff81813ab7f6809da9e7b542127e8b5.tar.gz chromium_src-92bba2412ff81813ab7f6809da9e7b542127e8b5.tar.bz2 |
Fix handling of spaces with paths in copy_test_data.py
This allows copying files with spaces in the paths (most notably,
profiles, which have a number of files containing spaces).
There are two fixes:
- Input/output lists \-escape spaces so that gyp will convert the output back into a list correctly.
- The argument list is no longer parsed by spaces, and the gyp call instead passes the input list as a list of separate arguments instead of one giant string.
BUG=None
Review URL: https://chromiumcodereview.appspot.com/11293198
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/copy_test_data_ios.py')
-rwxr-xr-x | build/copy_test_data_ios.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/build/copy_test_data_ios.py b/build/copy_test_data_ios.py index d785f26..6f0302f 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) |