Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Side by Side Diff: build/android/gyp/copy_ex.py

Issue 1134813003: Makes copy_ex handle directories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698