| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (C) 2009 Google Inc. All rights reserved. | 3 # Copyright (C) 2009 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 def extract_conditional(idl_file_path): | 114 def extract_conditional(idl_file_path): |
| 115 """Find [Conditional] interface extended attribute.""" | 115 """Find [Conditional] interface extended attribute.""" |
| 116 with open(idl_file_path) as idl_file: | 116 with open(idl_file_path) as idl_file: |
| 117 idl_contents = idl_file.read() | 117 idl_contents = idl_file.read() |
| 118 | 118 |
| 119 match = CONDITIONAL_PATTERN.search(idl_contents) | 119 match = CONDITIONAL_PATTERN.search(idl_contents) |
| 120 if not match: | 120 if not match: |
| 121 return None | 121 return None |
| 122 conditional = match.group(1) | 122 conditional = match.group(1) |
| 123 return re.split('([|&])', conditional) | 123 return re.split('([|,])', conditional) |
| 124 | 124 |
| 125 | 125 |
| 126 def extract_meta_data(file_paths): | 126 def extract_meta_data(file_paths): |
| 127 """Extracts conditional and interface name from each IDL file.""" | 127 """Extracts conditional and interface name from each IDL file.""" |
| 128 meta_data_list = [] | 128 meta_data_list = [] |
| 129 | 129 |
| 130 for file_path in file_paths: | 130 for file_path in file_paths: |
| 131 if not file_path.endswith('.idl'): | 131 if not file_path.endswith('.idl'): |
| 132 print 'WARNING: non-IDL file passed: "%s"' % file_path | 132 print 'WARNING: non-IDL file passed: "%s"' % file_path |
| 133 continue | 133 continue |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 files_meta_data_this_partition = [ | 220 files_meta_data_this_partition = [ |
| 221 meta_data for meta_data in files_meta_data | 221 meta_data for meta_data in files_meta_data |
| 222 if hash(meta_data['name']) % total_partitions == partition] | 222 if hash(meta_data['name']) % total_partitions == partition] |
| 223 file_contents = generate_content(component_dir, | 223 file_contents = generate_content(component_dir, |
| 224 files_meta_data_this_partition) | 224 files_meta_data_this_partition) |
| 225 write_content(file_contents, file_name) | 225 write_content(file_contents, file_name) |
| 226 | 226 |
| 227 | 227 |
| 228 if __name__ == '__main__': | 228 if __name__ == '__main__': |
| 229 sys.exit(main(sys.argv)) | 229 sys.exit(main(sys.argv)) |
| OLD | NEW |