| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 48 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
| 49 """ | 49 """ |
| 50 | 50 |
| 51 import errno | 51 import errno |
| 52 import os | 52 import os |
| 53 import re | 53 import re |
| 54 import subprocess | 54 import subprocess |
| 55 import sys | 55 import sys |
| 56 | 56 |
| 57 from utilities import idl_filename_to_interface_name |
| 58 |
| 57 # A regexp for finding Conditional attributes in interface definitions. | 59 # A regexp for finding Conditional attributes in interface definitions. |
| 58 CONDITIONAL_PATTERN = re.compile( | 60 CONDITIONAL_PATTERN = re.compile( |
| 59 r'\[' | 61 r'\[' |
| 60 r'[^\]]*' | 62 r'[^\]]*' |
| 61 r'Conditional=([\_0-9a-zA-Z&|]*)' | 63 r'Conditional=([\_0-9a-zA-Z&|]*)' |
| 62 r'[^\]]*' | 64 r'[^\]]*' |
| 63 r'\]\s*' | 65 r'\]\s*' |
| 64 r'((callback|partial)\s+)?' | 66 r'((callback|partial)\s+)?' |
| 65 r'interface\s+' | 67 r'interface\s+' |
| 66 r'\w+\s*' | 68 r'\w+\s*' |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 129 |
| 128 for file_path in file_paths: | 130 for file_path in file_paths: |
| 129 if not file_path.endswith('.idl'): | 131 if not file_path.endswith('.idl'): |
| 130 print 'WARNING: non-IDL file passed: "%s"' % file_path | 132 print 'WARNING: non-IDL file passed: "%s"' % file_path |
| 131 continue | 133 continue |
| 132 if not os.path.exists(file_path): | 134 if not os.path.exists(file_path): |
| 133 print 'WARNING: file not found: "%s"' % file_path | 135 print 'WARNING: file not found: "%s"' % file_path |
| 134 continue | 136 continue |
| 135 | 137 |
| 136 # Extract interface name from file name | 138 # Extract interface name from file name |
| 137 parent_path, file_name = os.path.split(file_path) | 139 interface_name = idl_filename_to_interface_name(file_path) |
| 138 interface_name, _ = os.path.splitext(file_name) | |
| 139 | 140 |
| 140 meta_data = { | 141 meta_data = { |
| 141 'conditional': extract_conditional(file_path), | 142 'conditional': extract_conditional(file_path), |
| 142 'name': interface_name, | 143 'name': interface_name, |
| 143 } | 144 } |
| 144 meta_data_list.append(meta_data) | 145 meta_data_list.append(meta_data) |
| 145 | 146 |
| 146 return meta_data_list | 147 return meta_data_list |
| 147 | 148 |
| 148 | 149 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 files_meta_data_this_partition = [ | 222 files_meta_data_this_partition = [ |
| 222 meta_data for meta_data in files_meta_data | 223 meta_data for meta_data in files_meta_data |
| 223 if hash(meta_data['name']) % total_partitions == partition] | 224 if hash(meta_data['name']) % total_partitions == partition] |
| 224 file_contents = generate_content(component_dir, | 225 file_contents = generate_content(component_dir, |
| 225 files_meta_data_this_partition) | 226 files_meta_data_this_partition) |
| 226 write_content(file_contents, file_name) | 227 write_content(file_contents, file_name) |
| 227 | 228 |
| 228 | 229 |
| 229 if __name__ == '__main__': | 230 if __name__ == '__main__': |
| 230 sys.exit(main(sys.argv)) | 231 sys.exit(main(sys.argv)) |
| OLD | NEW |