Add per-user preferences support.
[chromium-blink-merge.git] / tools / telemetry / count
blob01b50893767654694c737616189f09f869eef5d3
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.
6 import imp
7 import inspect
8 import os
10 from telemetry.util import path
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')
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')
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)
34 def main():
35 modules = ListFiles(path.GetTelemetryDir())
36 print len(modules)
39 if __name__ == '__main__':
40 main()