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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/bindings/scripts/interface_to_json.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/interface_node_path.py
diff --git a/Source/bindings/scripts/interface_node_path.py b/Source/bindings/scripts/interface_node_path.py
new file mode 100644
index 0000000000000000000000000000000000000000..f92d3bf36e14ffc6ae09ad8585b710950f70a822
--- /dev/null
+++ b/Source/bindings/scripts/interface_node_path.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+"""
+The goal of this script is to integrate IDL file path under the directory to text file.
bashi 2015/09/02 05:17:37 Please describe a typical usage here. Developers t
+"""
+import os
+import sys
+
+
+def get_idl_files(path):
+ """
bashi 2015/09/02 05:17:37 Please add one line summary as shiino-san suggeste
+ Args:
+ path: directory path
+ Return:
+ str, absolute IDL file path
bashi 2015/09/02 05:17:37 This function returns a generator, not a str.
+ """
+ file_type = '.idl'
+ non_idl_set = (
+ 'InspectorInstrumentation.idl',
+ )
bashi 2015/09/02 05:17:37 Let move |file_type| and |non_idl_set| out from th
+ for dir_path, dir_names, file_names in os.walk(path):
+ for file_name in file_names:
+ if file_name.endswith(file_type) and file_name not in non_idl_set:
+ yield os.path.join(dir_path, file_name)
+
+
+def main(args):
+ path = args[0]
+ filename = args[1]
+ f = open(filename, 'w')
bashi 2015/09/02 05:17:37 How about: with open(filename, 'w') as f: .
+ for filepath in get_idl_files(path):
+ f.write(filepath + '\n')
+ f.close()
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
« 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