Index: chrome/tools/build/list_test_installer_sources.py |
diff --git a/chrome/tools/build/list_test_installer_sources.py b/chrome/tools/build/list_test_installer_sources.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..783122a7eaccacf3191a0f384fb09668a0837bf8 |
--- /dev/null |
+++ b/chrome/tools/build/list_test_installer_sources.py |
@@ -0,0 +1,50 @@ |
+# 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. |
+ |
+import os |
+import pipes |
+import sys |
+ |
+def GetSources(dirname): |
+ """Returns a quoted list of source files. |
+ |
+ Args: |
+ dirname: A (possibly relative) path to the directory holding sources in |
+ question. |
+ |
+ Returns: |
+ A list of filenames. Items in the list will be quoted if needed. |
+ """ |
+ sources = [] |
+ for root, dirs, files in os.walk(dirname): |
+ for file in files: |
+ if file != 'OWNERS' and os.path.splitext(file)[1] != '.pyc': |
+ sources.append(pipes.quote(os.path.join(root, file).replace('\\', '/'))) |
+ return sources |
+ |
+ |
+def DoMain(args): |
+ """Returns a space-separated list of source files. |
+ |
+ Args: |
+ args: An agument list, the first item of which is the directory to scan. |
+ |
+ Returns: |
+ A string containing a space-separated list of source files. |
+ """ |
+ return ' '.join(GetSources(args[0])) |
+ |
+ |
+def main(args): |
+ """Prints the sources in a directory. |
+ |
+ Args: |
+ args: An argument list, the first item of which is the directory to scan. |
+ """ |
+ sys.stdout.write('\n'.join(GetSources(args[0]))) |
+ return 0 |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(main(sys.argv[1:])) |