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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/tools/generate_test_messages.py

Issue 1145243006: Port chromevox build to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@externs
Patch Set: Unshare some vars, add TODO for the rest. Created 5 years, 6 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
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 '''Generates test_messages.js from an extension message json file.''' 7 '''Generates test_messages.js from an extension message json file.'''
8 8
9 import optparse 9 import optparse
10 import sys 10 import sys
(...skipping 16 matching lines...) Expand all
27 def main(): 27 def main():
28 parser = optparse.OptionParser(description=__doc__) 28 parser = optparse.OptionParser(description=__doc__)
29 parser.add_option('-o', '--output_file', action='store', 29 parser.add_option('-o', '--output_file', action='store',
30 metavar='SPEC', 30 metavar='SPEC',
31 help=('Where to output the generated deps file.')) 31 help=('Where to output the generated deps file.'))
32 options, args = parser.parse_args() 32 options, args = parser.parse_args()
33 if options.output_file is None: 33 if options.output_file is None:
34 Die('Output file not specified') 34 Die('Output file not specified')
35 if len(args) != 1: 35 if len(args) != 1:
36 Die('Exactly one input file must be specified') 36 Die('Exactly one input file must be specified')
37 in_file_name = args[0]; 37 in_file_name = args[0]
38 with open(in_file_name) as in_file: 38 with open(in_file_name) as in_file:
39 json = in_file.read().strip() 39 json = in_file.read().strip()
40 with open(options.output_file, 'w') as out_file: 40 with open(options.output_file, 'w') as out_file:
41 out_file.write(_JS_TEMPLATE % {'in_file': in_file_name, 'json': json}) 41 out_file.write(_JS_TEMPLATE % {'in_file': in_file_name, 'json': json})
42 42
43 43
44 if __name__ == '__main__': 44 if __name__ == '__main__':
45 main() 45 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698