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

Side by Side Diff: tools/telemetry/telemetry/internal/util/find_dependencies.py

Issue 1263063003: Revert of Create classes_util API, change discover to return a list instead of a dict. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import fnmatch 5 import fnmatch
6 import imp 6 import imp
7 import logging 7 import logging
8 import modulefinder 8 import modulefinder
9 import optparse 9 import optparse
10 import os 10 import os
11 import sys 11 import sys
12 import zipfile 12 import zipfile
13 13
14 from catapult_base import cloud_storage 14 from catapult_base import cloud_storage
15 from telemetry import benchmark 15 from telemetry import benchmark
16 from telemetry.core import discover
16 from telemetry.internal.util import bootstrap 17 from telemetry.internal.util import bootstrap
17 from telemetry.internal.util import command_line 18 from telemetry.internal.util import command_line
18 from telemetry.internal.util import path 19 from telemetry.internal.util import path
19 from telemetry.internal.util import path_set 20 from telemetry.internal.util import path_set
20 from telemetry.util import classes_util
21
22 21
23 DEPS_FILE = 'bootstrap_deps' 22 DEPS_FILE = 'bootstrap_deps'
24 23
25 24
26 def FindBootstrapDependencies(base_dir): 25 def FindBootstrapDependencies(base_dir):
27 deps_file = os.path.join(base_dir, DEPS_FILE) 26 deps_file = os.path.join(base_dir, DEPS_FILE)
28 if not os.path.exists(deps_file): 27 if not os.path.exists(deps_file):
29 return [] 28 return []
30 deps_paths = bootstrap.ListAllDepsPaths(deps_file) 29 deps_paths = bootstrap.ListAllDepsPaths(deps_file)
31 return set(os.path.realpath(os.path.join( 30 return set(os.path.realpath(os.path.join(
(...skipping 24 matching lines...) Expand all
56 continue 55 continue
57 56
58 yield module_path 57 yield module_path
59 58
60 59
61 def FindPageSetDependencies(base_dir): 60 def FindPageSetDependencies(base_dir):
62 logging.info('Finding page sets in %s' % base_dir) 61 logging.info('Finding page sets in %s' % base_dir)
63 62
64 # Add base_dir to path so our imports relative to base_dir will work. 63 # Add base_dir to path so our imports relative to base_dir will work.
65 sys.path.append(base_dir) 64 sys.path.append(base_dir)
66 tests = classes_util.DiscoverClasses(base_dir, base_dir, benchmark.Benchmark) 65 tests = discover.DiscoverClasses(base_dir, base_dir, benchmark.Benchmark,
66 index_by_class_name=True)
67 67
68 for test_class in tests: 68 for test_class in tests.itervalues():
69 test_obj = test_class() 69 test_obj = test_class()
70 70
71 # Ensure the test's default options are set if needed. 71 # Ensure the test's default options are set if needed.
72 parser = optparse.OptionParser() 72 parser = optparse.OptionParser()
73 test_obj.AddCommandLineArgs(parser, None) 73 test_obj.AddCommandLineArgs(parser, None)
74 options = optparse.Values() 74 options = optparse.Values()
75 for k, v in parser.get_default_values().__dict__.iteritems(): 75 for k, v in parser.get_default_values().__dict__.iteritems():
76 options.ensure_value(k, v) 76 options.ensure_value(k, v)
77 77
78 # Page set paths are relative to their runner script, not relative to us. 78 # Page set paths are relative to their runner script, not relative to us.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 def Run(self, args): 244 def Run(self, args):
245 target_paths = args.positional_args 245 target_paths = args.positional_args
246 dependencies = FindDependencies(target_paths, args) 246 dependencies = FindDependencies(target_paths, args)
247 if args.zip: 247 if args.zip:
248 ZipDependencies(target_paths, dependencies, args) 248 ZipDependencies(target_paths, dependencies, args)
249 print 'Zip archive written to %s.' % args.zip 249 print 'Zip archive written to %s.' % args.zip
250 else: 250 else:
251 print '\n'.join(sorted(dependencies)) 251 print '\n'.join(sorted(dependencies))
252 return 0 252 return 0
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/internal/platform/tracing_controller_backend.py ('k') | tools/telemetry/telemetry/record_wpr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698