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

Side by Side Diff: dart/tools/only_in_release_mode.py

Issue 13784002: Only build apidoc in release mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright (c) 2013, 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 Wrapper around a build action that should only be executed in "release" mode.
9
10 The following options are accepted:
11
12 --mode=[release,debug]
13
14 --outputs=files...
15
16 If mode is not 'release', the script will create the files listed in
17 outputs. If mode is release, the script will execute the remaining
18 command line arguments as a command.
kustermann 2013/04/08 12:30:54 Would be nice if you can include an example here e
ahe 2013/04/08 12:42:46 Done.
19 """
20
21 import optparse
22 import subprocess
23 import sys
24
25
26 def BuildOptions():
27 result = optparse.OptionParser()
28 result.add_option('-m', '--mode')
29 result.add_option('-o', '--outputs')
30 return result
31
32
33 def Main():
34 (options, arguments) = BuildOptions().parse_args()
35 if options.mode != 'release':
36 print >> sys.stderr, 'Not running %s in mode=%s' % (arguments,
37 options.mode)
38 for output in options.outputs.strip('"').split('" "'):
39 with open(output, 'w'):
kustermann 2013/04/08 12:30:54 Add a comment (or a print statement) saying that y
ahe 2013/04/08 12:42:46 Done.
40 pass
41 return 0
42 else:
43 try:
44 subprocess.check_call(arguments)
45 except subprocess.CalledProcessError as e:
46 return e.returncode
47 return 0
48
49
50 if __name__ == '__main__':
51 sys.exit(Main())
OLDNEW
« no previous file with comments | « dart/tools/build.py ('k') | dart/utils/apidoc/apidoc.gyp » ('j') | dart/utils/apidoc/apidoc.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698