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

Side by Side Diff: tools/clean_output_directory.py

Issue 10830302: Add python script for clobbering the output directory of a build on any platform given the mode and… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« 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')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file.
6 #
7
8 import optparse
9 import shutil
10 import sys
11 import utils
12
13 HOST_OS = utils.GuessOS()
14
15 def BuildOptions():
16 result = optparse.OptionParser()
17 result.add_option("-m", "--mode",
18 help='Build variants (comma-separated).',
19 metavar='[all,debug,release]',
20 default='debug')
21 result.add_option("--arch",
22 help='Target architectures (comma-separated).',
23 metavar='[all,ia32,x64,simarm,arm]',
24 default=utils.GuessArchitecture())
25 return result
26
27 def ProcessOptions(options):
ricow1 2012/08/14 09:27:41 This is verbatim copy of the ProcessOptions in the
28 if options.arch == 'all':
29 options.arch = 'ia32,x64'
30 if options.mode == 'all':
31 options.mode = 'release,debug'
32 options.mode = options.mode.split(',')
33 options.arch = options.arch.split(',')
34 for mode in options.mode:
35 if not mode in ['debug', 'release']:
36 print "Unknown mode %s" % mode
37 return False
38 for arch in options.arch:
39 if not arch in ['ia32', 'x64', 'simarm', 'arm']:
40 print "Unknown arch %s" % arch
41 return False
42 return True
43
44 def Main():
45 parser = BuildOptions()
46 (options, args) = parser.parse_args()
47 if not ProcessOptions(options):
48 parser.print_help()
49 return 1
50
51 # Delete the output for the targets for each requested configuration.
52 for mode in options.mode:
53 for arch in options.arch:
54 build_root = utils.GetBuildRoot(HOST_OS, mode=mode, arch=arch)
55 print "Deleting %s" % (build_root)
56 shutil.rmtree(build_root, ignore_errors=True)
57 return 0
58
59 if __name__ == '__main__':
60 sys.exit(Main())
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