| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 class IdlCompiler(object): | 79 class IdlCompiler(object): |
| 80 """Abstract Base Class for IDL compilers. | 80 """Abstract Base Class for IDL compilers. |
| 81 | 81 |
| 82 In concrete classes: | 82 In concrete classes: |
| 83 * self.code_generator must be set, implementing generate_code() | 83 * self.code_generator must be set, implementing generate_code() |
| 84 (returning a list of output code), and | 84 (returning a list of output code), and |
| 85 * compile_file() must be implemented (handling output filenames). | 85 * compile_file() must be implemented (handling output filenames). |
| 86 """ | 86 """ |
| 87 __metaclass__ = abc.ABCMeta | 87 __metaclass__ = abc.ABCMeta |
| 88 | 88 |
| 89 def __init__(self, output_directory, cache_directory='', | 89 def __init__(self, output_directory, cache_directory=None, |
| 90 code_generator=None, interfaces_info=None, | 90 code_generator=None, interfaces_info=None, |
| 91 interfaces_info_filename='', only_if_changed=False, | 91 interfaces_info_filename='', only_if_changed=False, |
| 92 target_component=None): | 92 target_component=None): |
| 93 """ | 93 """ |
| 94 Args: | 94 Args: |
| 95 interfaces_info: | 95 interfaces_info: |
| 96 interfaces_info dict | 96 interfaces_info dict |
| 97 (avoids auxiliary file in run-bindings-tests) | 97 (avoids auxiliary file in run-bindings-tests) |
| 98 interfaces_info_file: filename of pickled interfaces_info | 98 interfaces_info_file: filename of pickled interfaces_info |
| 99 """ | 99 """ |
| 100 cache_directory = cache_directory or output_directory | |
| 101 self.cache_directory = cache_directory | 100 self.cache_directory = cache_directory |
| 102 self.code_generator = code_generator | 101 self.code_generator = code_generator |
| 103 if interfaces_info_filename: | 102 if interfaces_info_filename: |
| 104 with open(interfaces_info_filename) as interfaces_info_file: | 103 with open(interfaces_info_filename) as interfaces_info_file: |
| 105 interfaces_info = pickle.load(interfaces_info_file) | 104 interfaces_info = pickle.load(interfaces_info_file) |
| 106 self.interfaces_info = interfaces_info | 105 self.interfaces_info = interfaces_info |
| 107 self.only_if_changed = only_if_changed | 106 self.only_if_changed = only_if_changed |
| 108 self.output_directory = output_directory | 107 self.output_directory = output_directory |
| 109 self.target_component = target_component | 108 self.target_component = target_component |
| 110 self.reader = IdlReader(interfaces_info, cache_directory) | 109 self.reader = IdlReader(interfaces_info, cache_directory) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 # |input_filename| should be a file which contains a list of IDL | 172 # |input_filename| should be a file which contains a list of IDL |
| 174 # dictionary paths. | 173 # dictionary paths. |
| 175 generate_dictionary_impl(options, input_filename) | 174 generate_dictionary_impl(options, input_filename) |
| 176 else: | 175 else: |
| 177 # |input_filename| should be a path of an IDL file. | 176 # |input_filename| should be a path of an IDL file. |
| 178 generate_bindings(options, input_filename) | 177 generate_bindings(options, input_filename) |
| 179 | 178 |
| 180 | 179 |
| 181 if __name__ == '__main__': | 180 if __name__ == '__main__': |
| 182 sys.exit(main()) | 181 sys.exit(main()) |
| OLD | NEW |