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

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

Issue 1376673003: Collect idls and organize interface node (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 2 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 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Usage: interface_node_path.py directory-path text_file
7
8 The goal of this script is to integrate IDL file path under the directory to tex t file.
9 """
10 import os
11 import sys
12
13 _IDL_SUFFIX = '.idl'
14 _NON_IDL_FILES = frozenset([
15 'InspectorInstrumentation.idl',
16 ])
17
18
19 def get_idl_files(path):
20 """Return a generator which has absolute path of IDL files.
21 Args:
22 path: directory path
23 Returns:
24 a generator which yields absolute IDL file path
25 """
26 for dir_path, dir_names, file_names in os.walk(path):
27 for file_name in file_names:
28 if file_name.endswith(_IDL_SUFFIX) and file_name not in _NON_IDL_FIL ES:
29 yield os.path.join(dir_path, file_name)
30
31
32 def main(args):
33 path = args[0]
34 filename = args[1]
35 with open(filename, 'w') as f:
36 for filepath in get_idl_files(path):
37 f.write(filepath + '\n')
38
39
40 if __name__ == '__main__':
41 main(sys.argv[1:])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698