OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """The frontend for the Mojo bindings system.""" | 6 """The frontend for the Mojo bindings system.""" |
7 | 7 |
8 | 8 |
9 import argparse | 9 import argparse |
10 import imp | 10 import imp |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 parser = argparse.ArgumentParser( | 163 parser = argparse.ArgumentParser( |
164 description="Generate bindings from mojom files.") | 164 description="Generate bindings from mojom files.") |
165 parser.add_argument("filename", nargs="+", | 165 parser.add_argument("filename", nargs="+", |
166 help="mojom input file") | 166 help="mojom input file") |
167 parser.add_argument("-d", "--depth", dest="depth", default=".", | 167 parser.add_argument("-d", "--depth", dest="depth", default=".", |
168 help="depth from source root") | 168 help="depth from source root") |
169 parser.add_argument("-o", "--output_dir", dest="output_dir", default=".", | 169 parser.add_argument("-o", "--output_dir", dest="output_dir", default=".", |
170 help="output directory for generated files") | 170 help="output directory for generated files") |
171 parser.add_argument("-g", "--generators", dest="generators_string", | 171 parser.add_argument("-g", "--generators", dest="generators_string", |
172 metavar="GENERATORS", | 172 metavar="GENERATORS", |
173 default="c++,javascript,java,python", | 173 default="c++", |
174 help="comma-separated list of generators") | 174 help="comma-separated list of generators") |
175 parser.add_argument("--debug_print_intermediate", action="store_true", | 175 parser.add_argument("--debug_print_intermediate", action="store_true", |
176 help="print the intermediate representation") | 176 help="print the intermediate representation") |
177 parser.add_argument("-I", dest="import_directories", action="append", | 177 parser.add_argument("-I", dest="import_directories", action="append", |
178 metavar="directory", default=[], | 178 metavar="directory", default=[], |
179 help="add a directory to be searched for import files") | 179 help="add a directory to be searched for import files") |
180 parser.add_argument("--use_chromium_bundled_pylibs", action="store_true", | 180 parser.add_argument("--use_chromium_bundled_pylibs", action="store_true", |
181 help="use Python modules bundled in the Chromium source") | 181 help="use Python modules bundled in the Chromium source") |
182 (args, remaining_args) = parser.parse_known_args() | 182 (args, remaining_args) = parser.parse_known_args() |
183 | 183 |
184 generator_modules = LoadGenerators(args.generators_string) | 184 generator_modules = LoadGenerators(args.generators_string) |
185 | 185 |
186 if not os.path.exists(args.output_dir): | 186 if not os.path.exists(args.output_dir): |
187 os.makedirs(args.output_dir) | 187 os.makedirs(args.output_dir) |
188 | 188 |
189 for filename in args.filename: | 189 for filename in args.filename: |
190 ProcessFile(args, remaining_args, generator_modules, filename) | 190 ProcessFile(args, remaining_args, generator_modules, filename) |
191 | 191 |
192 return 0 | 192 return 0 |
193 | 193 |
194 | 194 |
195 if __name__ == "__main__": | 195 if __name__ == "__main__": |
196 sys.exit(main()) | 196 sys.exit(main()) |
OLD | NEW |