| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 # Copyright (C) 2013 Google Inc. All rights reserved. | 2 # Copyright (C) 2013 Google Inc. All rights reserved. | 
| 3 # | 3 # | 
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without | 
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are | 
| 6 # met: | 6 # met: | 
| 7 # | 7 # | 
| 8 #     * Redistributions of source code must retain the above copyright | 8 #     * Redistributions of source code must retain the above copyright | 
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. | 
| 10 #     * Redistributions in binary form must reproduce the above | 10 #     * Redistributions in binary form must reproduce the above | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 42 incrementally. See http://crbug.com/239771 | 42 incrementally. See http://crbug.com/239771 | 
| 43 """ | 43 """ | 
| 44 import optparse | 44 import optparse | 
| 45 import os | 45 import os | 
| 46 import pickle | 46 import pickle | 
| 47 import posixpath | 47 import posixpath | 
| 48 import shlex | 48 import shlex | 
| 49 import sys | 49 import sys | 
| 50 | 50 | 
| 51 import code_generator_v8 | 51 import code_generator_v8 | 
|  | 52 import my_code_generator_v8 | 
| 52 import idl_reader | 53 import idl_reader | 
| 53 | 54 | 
| 54 | 55 | 
| 55 def parse_options(): | 56 def parse_options(): | 
| 56     parser = optparse.OptionParser() | 57     parser = optparse.OptionParser() | 
| 57     parser.add_option('--additional-idl-files') | 58     parser.add_option('--additional-idl-files') | 
| 58     # FIXME: The --dump-json-and-pickle option is only for debugging and will | 59     # FIXME: The --dump-json-and-pickle option is only for debugging and will | 
| 59     # be removed once we complete migrating all IDL files from the Perl flow to | 60     # be removed once we complete migrating all IDL files from the Perl flow to | 
| 60     # the Python flow. | 61     # the Python flow. | 
| 61     parser.add_option('--dump-json-and-pickle', action='store_true', default=Fal
     se) | 62     parser.add_option('--dump-json-and-pickle', action='store_true', default=Fal
     se) | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 106     basename = os.path.basename(idl_filename) | 107     basename = os.path.basename(idl_filename) | 
| 107     interface_name, _ = os.path.splitext(basename) | 108     interface_name, _ = os.path.splitext(basename) | 
| 108     output_directory = options.output_directory | 109     output_directory = options.output_directory | 
| 109     verbose = options.verbose | 110     verbose = options.verbose | 
| 110     if verbose: | 111     if verbose: | 
| 111         print idl_filename | 112         print idl_filename | 
| 112     relative_dir_posix = get_relative_dir_posix(idl_filename) | 113     relative_dir_posix = get_relative_dir_posix(idl_filename) | 
| 113 | 114 | 
| 114     reader = idl_reader.IdlReader(options.interface_dependencies_file, options.a
     dditional_idl_files, options.idl_attributes_file, output_directory, verbose) | 115     reader = idl_reader.IdlReader(options.interface_dependencies_file, options.a
     dditional_idl_files, options.idl_attributes_file, output_directory, verbose) | 
| 115     definitions = reader.read_idl_definitions(idl_filename) | 116     definitions = reader.read_idl_definitions(idl_filename) | 
| 116     code_generator = code_generator_v8.CodeGeneratorV8(definitions, interface_na
     me, options.output_directory, relative_dir_posix, options.idl_directories, verbo
     se) | 117     try: | 
| 117     if not definitions: | 118         code_generator = code_generator_v8.CodeGeneratorV8(definitions, interfac
     e_name, options.output_directory, relative_dir_posix, options.idl_directories, v
     erbose) | 
| 118         # We generate dummy .h and .cpp files just to tell build scripts | 119         if not definitions: | 
| 119         # that outputs have been created. | 120             # We generate dummy .h and .cpp files just to tell build scripts | 
| 120         code_generator.write_dummy_header_and_cpp() | 121             # that outputs have been created. | 
| 121         return | 122             code_generator.write_dummy_header_and_cpp() | 
| 122     if options.dump_json_and_pickle: | 123             return | 
| 123         write_json_and_pickle(definitions, interface_name, output_directory) | 124         if options.dump_json_and_pickle: | 
| 124         return | 125             write_json_and_pickle(definitions, interface_name, output_directory) | 
| 125     code_generator.write_header_and_cpp() | 126             return | 
|  | 127         code_generator.write_header_and_cpp() | 
|  | 128     except Exception as err: | 
|  | 129         # Log exceptions, but don't fail (just testing) | 
|  | 130         print err | 
| 126 | 131 | 
| 127 | 132 | 
| 128 if __name__ == '__main__': | 133 if __name__ == '__main__': | 
| 129     sys.exit(main()) | 134     sys.exit(main()) | 
| OLD | NEW | 
|---|