OLD | NEW |
(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 import imp |
| 7 import inspect |
| 8 import os |
| 9 |
| 10 from telemetry.util import path |
| 11 |
| 12 |
| 13 def IncludeDir(dir_name): |
| 14 return (dir_name[0] != '.' and dir_name[0] != '_' and |
| 15 not dir_name.startswith('internal') and not dir_name == 'third_party') |
| 16 |
| 17 |
| 18 def IncludeFile(file_name): |
| 19 root, ext = os.path.splitext(file_name) |
| 20 return (file_name[0] != '.' and |
| 21 not root.endswith('_unittest') and ext == '.py') |
| 22 |
| 23 |
| 24 def ListFiles(directory): |
| 25 matching_files = [] |
| 26 for root, dirs, files in os.walk(directory): |
| 27 dirs[:] = [dir_name for dir_name in dirs if IncludeDir(dir_name)] |
| 28 matching_files += [ |
| 29 os.path.relpath(os.path.join(root, file_name), directory) |
| 30 for file_name in files if IncludeFile(file_name)] |
| 31 return sorted(matching_files) |
| 32 |
| 33 |
| 34 def main(): |
| 35 modules = ListFiles(path.GetTelemetryDir()) |
| 36 print len(modules) |
| 37 |
| 38 |
| 39 if __name__ == '__main__': |
| 40 main() |
OLD | NEW |