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

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: comment 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
« no previous file with comments | « no previous file | Source/bindings/scripts/interface_to_json.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 """
4 The goal of this script is to integrate IDL file path under the directory to tex t file.
bashi 2015/09/02 05:17:37 Please describe a typical usage here. Developers t
5 """
6 import os
7 import sys
8
9
10 def get_idl_files(path):
11 """
bashi 2015/09/02 05:17:37 Please add one line summary as shiino-san suggeste
12 Args:
13 path: directory path
14 Return:
15 str, absolute IDL file path
bashi 2015/09/02 05:17:37 This function returns a generator, not a str.
16 """
17 file_type = '.idl'
18 non_idl_set = (
19 'InspectorInstrumentation.idl',
20 )
bashi 2015/09/02 05:17:37 Let move |file_type| and |non_idl_set| out from th
21 for dir_path, dir_names, file_names in os.walk(path):
22 for file_name in file_names:
23 if file_name.endswith(file_type) and file_name not in non_idl_set:
24 yield os.path.join(dir_path, file_name)
25
26
27 def main(args):
28 path = args[0]
29 filename = args[1]
30 f = open(filename, 'w')
bashi 2015/09/02 05:17:37 How about: with open(filename, 'w') as f: .
31 for filepath in get_idl_files(path):
32 f.write(filepath + '\n')
33 f.close()
34
35
36 if __name__ == '__main__':
37 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/interface_to_json.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698