Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: Source/bindings/scripts/interface_node_path.py

Issue 1323493002: Collect IDL files and exract interface node object's information (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add explanation of each function Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 """Usage: interface_node_path.py directory-path text_file
4
5 The goal of this script is to integrate IDL file path under the directory to tex t file.
6 """
7 import os
8 import sys
9
10 _IDL_SUFFIX = '.idl'
11 _NON_IDL_FILES = frozenset([
12 'InspectorInstrumentation.idl',
13 ])
14
15
16 def get_idl_files(path):
17 """Return a generator which has absolute path of IDL files.
18 Args:
19 path: directory path
20 Return:
21 generator, absolute IDL file path
22 """
23 for dir_path, dir_names, file_names in os.walk(path):
24 for file_name in file_names:
25 if file_name.endswith(_IDL_SUFFIX) and file_name not in _NON_IDL_FIL ES:
26 yield os.path.join(dir_path, file_name)
27
28
29 def main(args):
30 path = args[0]
31 filename = args[1]
32 with open(filename, 'w') as f:
33 for filepath in get_idl_files(path):
34 f.write(filepath + '\n')
35
36
37 if __name__ == '__main__':
38 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/interface_to_json.py » ('j') | Source/bindings/scripts/interface_to_json.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698