Chromium Code Reviews| Index: build/android/pylib/build_utils.py |
| diff --git a/build/android/pylib/build_utils.py b/build/android/pylib/build_utils.py |
| index 571e733eae6712993ac8289035326c15f1b52338..8849a77df69b7ea79876bfbbf308f390cc2f3a25 100644 |
| --- a/build/android/pylib/build_utils.py |
| +++ b/build/android/pylib/build_utils.py |
| @@ -2,13 +2,52 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +import fnmatch |
| import os |
| +import shlex |
| +import shutil |
| -def EnsureDirectoryExists(dir_path): |
| +def MakeDirectory(dir_path): |
|
newt (away)
2013/03/15 23:01:19
Yea, that's clearer.
|
| try: |
| os.makedirs(dir_path) |
| except OSError: |
| pass |
| +def DeleteDirectory(dir_path): |
| + if os.path.exists(dir_path): |
| + shutil.rmtree(dir_path) |
| + |
| + |
| +def Touch(path): |
| + MakeDirectory(os.path.dirname(path)) |
| + with open(path, 'a'): |
| + os.utime(path, None) |
| + |
| + |
| +def FindInDirectory(directory, filter): |
| + files = [] |
| + for root, dirnames, filenames in os.walk(directory): |
| + matched_files = fnmatch.filter(filenames, filter) |
| + files.extend((os.path.join(root, f) for f in matched_files)) |
| + return files |
| + |
| + |
| +def FindInDirectories(directories, filter): |
| + all_files = [] |
| + for directory in directories: |
| + all_files.extend(FindInDirectory(directory, filter)) |
| + return all_files |
| + |
| + |
| +def ParseGypList(gyp_string): |
| + # The ninja generator doesn't support $ in strings, so use ## to |
| + # represent $. |
| + # TODO(cjhopman): Remove when |
| + # https://code.google.com/p/gyp/issues/detail?id=327 |
| + # is addressed. |
| + gyp_string = gyp_string.replace('##', '$') |
| + return shlex.split(gyp_string) |
| + |
| + |