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

Unified 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: Change the variable names 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/collect_idls_into_json.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/scripts/interface_node_path.py
diff --git a/third_party/WebKit/Source/bindings/scripts/interface_node_path.py b/third_party/WebKit/Source/bindings/scripts/interface_node_path.py
new file mode 100755
index 0000000000000000000000000000000000000000..de1d5f14535d2211499c286839afe0cd7268504a
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/scripts/interface_node_path.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Usage: interface_node_path.py directory-path text_file
+
+The goal of this script is to integrate IDL file path under the directory to text file.
+"""
+import os
+import sys
+
+_IDL_SUFFIX = '.idl'
+_NON_IDL_FILES = frozenset([
+ 'InspectorInstrumentation.idl',
+])
+
+
+def get_idl_files(path):
+ """Return a generator which has absolute path of IDL files.
+ Args:
+ path: directory path
+ Returns:
+ a generator which yields absolute IDL file path
+ """
+ for dir_path, dir_names, file_names in os.walk(path):
+ for file_name in file_names:
+ if file_name.endswith(_IDL_SUFFIX) and file_name not in _NON_IDL_FILES:
+ yield os.path.join(dir_path, file_name)
+
+
+def main(args):
+ path = args[0]
+ filename = args[1]
+ with open(filename, 'w') as f:
+ for filepath in get_idl_files(path):
+ f.write(filepath + '\n')
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/collect_idls_into_json.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698