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

Side by Side Diff: CodeGenerator.py

Issue 2978263002: [inspector_protocol] Fix building with non-ASCII paths
Patch Set: Created 3 years, 5 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 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os.path 5 import os.path
6 import sys 6 import sys
7 import optparse 7 import optparse
8 import collections 8 import collections
9 import functools 9 import functools
10 import re 10 import re
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 try: 52 try:
53 cmdline_parser = optparse.OptionParser() 53 cmdline_parser = optparse.OptionParser()
54 cmdline_parser.add_option("--output_base") 54 cmdline_parser.add_option("--output_base")
55 cmdline_parser.add_option("--jinja_dir") 55 cmdline_parser.add_option("--jinja_dir")
56 cmdline_parser.add_option("--config") 56 cmdline_parser.add_option("--config")
57 cmdline_parser.add_option("--config_value", action="append", type="strin g") 57 cmdline_parser.add_option("--config_value", action="append", type="strin g")
58 arg_options, _ = cmdline_parser.parse_args() 58 arg_options, _ = cmdline_parser.parse_args()
59 jinja_dir = arg_options.jinja_dir 59 jinja_dir = arg_options.jinja_dir
60 if not jinja_dir: 60 if not jinja_dir:
61 raise Exception("jinja directory must be specified") 61 raise Exception("jinja directory must be specified")
62 jinja_dir = jinja_dir.decode('utf8')
62 output_base = arg_options.output_base 63 output_base = arg_options.output_base
63 if not output_base: 64 if not output_base:
64 raise Exception("Base output directory must be specified") 65 raise Exception("Base output directory must be specified")
66 output_base = output_base.decode('utf8')
65 config_file = arg_options.config 67 config_file = arg_options.config
66 if not config_file: 68 if not config_file:
67 raise Exception("Config file name must be specified") 69 raise Exception("Config file name must be specified")
70 config_file = config_file.decode('utf8')
68 config_base = os.path.dirname(config_file) 71 config_base = os.path.dirname(config_file)
69 config_values = arg_options.config_value 72 config_values = arg_options.config_value
70 if not config_values: 73 if not config_values:
71 config_values = [] 74 config_values = []
72 except Exception: 75 except Exception:
73 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.h tml 76 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.h tml
74 exc = sys.exc_info()[1] 77 exc = sys.exc_info()[1]
75 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) 78 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc)
76 exit(1) 79 exit(1)
77 80
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 if up_to_date: 596 if up_to_date:
594 sys.exit() 597 sys.exit()
595 598
596 for file_name, content in outputs.iteritems(): 599 for file_name, content in outputs.iteritems():
597 out_file = open(file_name, "w") 600 out_file = open(file_name, "w")
598 out_file.write(content) 601 out_file.write(content)
599 out_file.close() 602 out_file.close()
600 603
601 604
602 main() 605 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