Chromium Code Reviews| Index: build/android/gyp/copy_ex.py |
| diff --git a/build/android/gyp/copy_ex.py b/build/android/gyp/copy_ex.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..a8e201a81aae5e7ca30a2822bd6cf8d65abfe4f6 |
| --- /dev/null |
| +++ b/build/android/gyp/copy_ex.py |
| @@ -0,0 +1,55 @@ |
| +#!/usr/bin/env python |
| +# |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +"""Copies files to a directory.""" |
| + |
| +import optparse |
| +import shutil |
| +import sys |
| + |
| +from util import build_utils |
| + |
| +def main(args): |
| + args = build_utils.ExpandFileArgs(args) |
| + |
| + parser = optparse.OptionParser() |
| + build_utils.AddDepfileOption(parser) |
| + |
| + parser.add_option('--todir', help='Directory to copy files to.') |
|
newt (away)
2014/08/11 23:55:23
"dest"?
cjhopman
2014/08/18 01:21:11
Done.
|
| + parser.add_option('--files', action='append', |
| + help='List of files to copy.') |
| + parser.add_option('--clear', action='store_true', |
| + help='If set, todir will be deleted before copying files ' |
| + 'to it. This is highly recommended to ensure that no stale ' |
| + 'files are left in the directory.') |
| + parser.add_option('--stamp', help='Path to touch on success.') |
| + |
| + options, _ = parser.parse_args(args) |
| + |
| + |
|
newt (away)
2014/08/11 23:55:23
move extra newline to above "main"
cjhopman
2014/08/18 01:21:11
Done.
|
| + if options.clear: |
| + build_utils.DeleteDirectory(options.todir) |
| + build_utils.MakeDirectory(options.todir) |
| + |
| + files = [] |
| + for file_opt in options.files: |
|
newt (away)
2014/08/11 23:55:23
what's "_opt"?
cjhopman
2014/08/18 01:21:11
I don't know if this is any better.
|
| + files += build_utils.ParseGypList(file_opt) |
| + |
| + for f in files: |
| + shutil.copy(f, options.todir) |
| + |
| + if options.depfile: |
| + build_utils.WriteDepfile( |
| + options.depfile, |
| + options.files + build_utils.GetPythonDependencies()) |
| + |
| + if options.stamp: |
| + build_utils.Touch(options.stamp) |
| + |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main(sys.argv[1:])) |
| + |