| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Usage: collect_idls_into_json.py path_file.txt json_file.json | 6 """Usage: collect_idls_into_json.py path_file.txt json_file.json |
| 7 This script collects and organizes interface information and that information du
mps into json file. | 7 This script collects and organizes interface information and that information du
mps into json file. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import json | 10 import json |
| 11 import os | 11 import os |
| 12 import sys | 12 import sys |
| 13 |
| 14 _bindings_path = os.path.normpath( |
| 15 os.path.join(os.path.dirname(__file__), |
| 16 os.pardir, os.pardir, os.pardir, os.pardir, |
| 17 'Source', 'bindings', 'scripts')) |
| 18 |
| 19 if _bindings_path not in sys.path: |
| 20 sys.path.append(_bindings_path) |
| 21 |
| 13 import utilities | 22 import utilities |
| 23 from blink_idl_parser import parse_file, BlinkIDLParser |
| 14 | 24 |
| 15 | 25 |
| 16 from blink_idl_parser import parse_file, BlinkIDLParser | |
| 17 | |
| 18 _INTERFACE = 'Interface' | 26 _INTERFACE = 'Interface' |
| 19 _IMPLEMENT = 'Implements' | 27 _IMPLEMENT = 'Implements' |
| 20 _PARTIAL = 'Partial' | 28 _PARTIAL = 'Partial' |
| 21 _NAME = 'Name' | 29 _NAME = 'Name' |
| 22 _TYPE = 'Type' | 30 _TYPE = 'Type' |
| 23 _UNIONTYPE = 'UnionType' | 31 _UNIONTYPE = 'UnionType' |
| 24 _ARRAY = 'Array' | 32 _ARRAY = 'Array' |
| 25 _ANY = 'Any' | 33 _ANY = 'Any' |
| 26 _SEQUENCE = 'Sequence' | 34 _SEQUENCE = 'Sequence' |
| 27 _PROP_VALUE = 'VALUE' | 35 _PROP_VALUE = 'VALUE' |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 partials_dict = {definition.GetName(): interface_node_to_dict(definition) | 431 partials_dict = {definition.GetName(): interface_node_to_dict(definition) |
| 424 for definition in get_definitions(path_list) | 432 for definition in get_definitions(path_list) |
| 425 if is_partial(definition)} | 433 if is_partial(definition)} |
| 426 dictionary = merge_partial_dicts(interfaces_dict, partials_dict) | 434 dictionary = merge_partial_dicts(interfaces_dict, partials_dict) |
| 427 interfaces_dict = merge_implement_nodes(interfaces_dict, implement_node_list
) | 435 interfaces_dict = merge_implement_nodes(interfaces_dict, implement_node_list
) |
| 428 export_to_jsonfile(dictionary, json_file) | 436 export_to_jsonfile(dictionary, json_file) |
| 429 | 437 |
| 430 | 438 |
| 431 if __name__ == '__main__': | 439 if __name__ == '__main__': |
| 432 main(sys.argv[1:]) | 440 main(sys.argv[1:]) |
| OLD | NEW |