OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 """Copies files to a directory.""" |
| 8 |
| 9 import optparse |
| 10 import shutil |
| 11 import sys |
| 12 |
| 13 from util import build_utils |
| 14 |
| 15 |
| 16 def main(args): |
| 17 args = build_utils.ExpandFileArgs(args) |
| 18 |
| 19 parser = optparse.OptionParser() |
| 20 build_utils.AddDepfileOption(parser) |
| 21 |
| 22 parser.add_option('--dest', help='Directory to copy files to.') |
| 23 parser.add_option('--files', action='append', |
| 24 help='List of files to copy.') |
| 25 parser.add_option('--clear', action='store_true', |
| 26 help='If set, the destination directory will be deleted ' |
| 27 'before copying files to it. This is highly recommended to ' |
| 28 'ensure that no stale files are left in the directory.') |
| 29 parser.add_option('--stamp', help='Path to touch on success.') |
| 30 |
| 31 options, _ = parser.parse_args(args) |
| 32 |
| 33 if options.clear: |
| 34 build_utils.DeleteDirectory(options.dest) |
| 35 build_utils.MakeDirectory(options.dest) |
| 36 |
| 37 files = [] |
| 38 for file_arg in options.files: |
| 39 files += build_utils.ParseGypList(file_arg) |
| 40 |
| 41 for f in files: |
| 42 shutil.copy(f, options.dest) |
| 43 |
| 44 if options.depfile: |
| 45 build_utils.WriteDepfile( |
| 46 options.depfile, |
| 47 options.files + build_utils.GetPythonDependencies()) |
| 48 |
| 49 if options.stamp: |
| 50 build_utils.Touch(options.stamp) |
| 51 |
| 52 |
| 53 if __name__ == '__main__': |
| 54 sys.exit(main(sys.argv[1:])) |
| 55 |
OLD | NEW |