| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (C) 2013 Google Inc. All rights reserved. | 3 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 this_include_path=None): | 142 this_include_path=None): |
| 143 paths_dict = self.partial_interface_files[partial_interface_name] | 143 paths_dict = self.partial_interface_files[partial_interface_name] |
| 144 paths_dict['full_paths'].append(full_path) | 144 paths_dict['full_paths'].append(full_path) |
| 145 if this_include_path: | 145 if this_include_path: |
| 146 paths_dict['include_paths'].append(this_include_path) | 146 paths_dict['include_paths'].append(this_include_path) |
| 147 | 147 |
| 148 def collect_info(self, idl_filename): | 148 def collect_info(self, idl_filename): |
| 149 """Reads an idl file and collects information which is required by the | 149 """Reads an idl file and collects information which is required by the |
| 150 binding code generation.""" | 150 binding code generation.""" |
| 151 definitions = self.reader.read_idl_file(idl_filename) | 151 definitions = self.reader.read_idl_file(idl_filename) |
| 152 if len(definitions.interfaces) > 0: | 152 if definitions.interfaces: |
| 153 definition = next(definitions.interfaces.itervalues()) | 153 definition = next(definitions.interfaces.itervalues()) |
| 154 interface_info = { | 154 interface_info = { |
| 155 'is_callback_interface': definition.is_callback, | 155 'is_callback_interface': definition.is_callback, |
| 156 'is_dictionary': False, | 156 'is_dictionary': False, |
| 157 # Interfaces that are referenced (used as types) and that we | 157 # Interfaces that are referenced (used as types) and that we |
| 158 # introspect during code generation (beyond interface-level | 158 # introspect during code generation (beyond interface-level |
| 159 # data ([ImplementedAs], is_callback_interface, ancestors, and | 159 # data ([ImplementedAs], is_callback_interface, ancestors, and |
| 160 # inherited extended attributes): deep dependencies. | 160 # inherited extended attributes): deep dependencies. |
| 161 # These cause rebuilds of referrers, due to the dependency, | 161 # These cause rebuilds of referrers, due to the dependency, |
| 162 # so these should be minimized; currently only targets of | 162 # so these should be minimized; currently only targets of |
| 163 # [PutForwards]. | 163 # [PutForwards]. |
| 164 'referenced_interfaces': get_put_forward_interfaces_from_definit
ion(definition), | 164 'referenced_interfaces': get_put_forward_interfaces_from_definit
ion(definition), |
| 165 } | 165 } |
| 166 elif len(definitions.dictionaries) > 0: | 166 elif definitions.dictionaries: |
| 167 definition = next(definitions.dictionaries.itervalues()) | 167 definition = next(definitions.dictionaries.itervalues()) |
| 168 interface_info = { | 168 interface_info = { |
| 169 'is_callback_interface': False, | 169 'is_callback_interface': False, |
| 170 'is_dictionary': True, | 170 'is_dictionary': True, |
| 171 'referenced_interfaces': None, | 171 'referenced_interfaces': None, |
| 172 } | 172 } |
| 173 else: | 173 else: |
| 174 raise Exception('IDL file must contain one interface or dictionary') | 174 raise Exception('IDL file must contain one interface or dictionary') |
| 175 | 175 |
| 176 extended_attributes = definition.extended_attributes | 176 extended_attributes = definition.extended_attributes |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 for idl_filename in idl_files: | 234 for idl_filename in idl_files: |
| 235 info_collector.collect_info(idl_filename) | 235 info_collector.collect_info(idl_filename) |
| 236 | 236 |
| 237 write_pickle_file(options.interfaces_info_file, | 237 write_pickle_file(options.interfaces_info_file, |
| 238 info_collector.get_info_as_dict(), | 238 info_collector.get_info_as_dict(), |
| 239 options.write_file_only_if_changed) | 239 options.write_file_only_if_changed) |
| 240 | 240 |
| 241 | 241 |
| 242 if __name__ == '__main__': | 242 if __name__ == '__main__': |
| 243 sys.exit(main()) | 243 sys.exit(main()) |
| OLD | NEW |