Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Copies files to a directory.""" | 7 """Copies files to a directory.""" |
| 8 | 8 |
| 9 import optparse | 9 import optparse |
| 10 import os | |
| 10 import shutil | 11 import shutil |
| 11 import sys | 12 import sys |
| 12 | 13 |
| 13 from util import build_utils | 14 from util import build_utils |
| 14 | 15 |
| 15 | 16 |
| 16 def main(args): | 17 def main(args): |
| 17 args = build_utils.ExpandFileArgs(args) | 18 args = build_utils.ExpandFileArgs(args) |
| 18 | 19 |
| 19 parser = optparse.OptionParser() | 20 parser = optparse.OptionParser() |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 32 | 33 |
| 33 if options.clear: | 34 if options.clear: |
| 34 build_utils.DeleteDirectory(options.dest) | 35 build_utils.DeleteDirectory(options.dest) |
| 35 build_utils.MakeDirectory(options.dest) | 36 build_utils.MakeDirectory(options.dest) |
| 36 | 37 |
| 37 files = [] | 38 files = [] |
| 38 for file_arg in options.files: | 39 for file_arg in options.files: |
| 39 files += build_utils.ParseGypList(file_arg) | 40 files += build_utils.ParseGypList(file_arg) |
| 40 | 41 |
| 41 for f in files: | 42 for f in files: |
| 42 shutil.copy(f, options.dest) | 43 if os.path.isdir(f): |
| 44 shutil.copytree(f, os.path.join(options.dest, os.path.basename(f))) | |
|
cjhopman
2015/05/08 22:58:55
I would require that options.clear be set if any d
sky
2015/05/08 23:38:31
Why is it different than with files? The same prob
cjhopman
2015/05/08 23:57:05
Yeah, exactly, I don't trust people (including mys
| |
| 45 else: | |
| 46 shutil.copy(f, options.dest) | |
| 43 | 47 |
| 44 if options.depfile: | 48 if options.depfile: |
| 45 build_utils.WriteDepfile( | 49 build_utils.WriteDepfile( |
| 46 options.depfile, | 50 options.depfile, |
| 47 files + build_utils.GetPythonDependencies()) | 51 files + build_utils.GetPythonDependencies()) |
|
cjhopman
2015/05/08 22:58:55
The depfile should list the entire contents of the
sky
2015/05/08 23:38:31
I totally missed that. I believe I've fixed it.
| |
| 48 | 52 |
| 49 if options.stamp: | 53 if options.stamp: |
| 50 build_utils.Touch(options.stamp) | 54 build_utils.Touch(options.stamp) |
| 51 | 55 |
| 52 | 56 |
| 53 if __name__ == '__main__': | 57 if __name__ == '__main__': |
| 54 sys.exit(main(sys.argv[1:])) | 58 sys.exit(main(sys.argv[1:])) |
| 55 | 59 |
| OLD | NEW |