| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """This module fetches and prints the dependencies given a benchmark.""" | 6 """This module fetches and prints the dependencies given a benchmark.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'telemetry')) | 11 |
| 12 def _GetPerfDir(*subdirs): |
| 13 perf_dir = os.path.realpath(os.path.dirname(os.path.abspath(__file__))) |
| 14 return os.path.join(perf_dir, *subdirs) |
| 15 |
| 16 |
| 17 def GetChromiumDir(): |
| 18 return os.path.abspath(_GetPerfDir('..', '..', '..')) |
| 19 |
| 20 |
| 21 telemetry_path = os.path.os.path.join(GetChromiumDir(), 'tools', 'telemetry') |
| 22 if telemetry_path not in sys.path: |
| 23 sys.path.insert(1, telemetry_path) |
| 24 catapult_base_path = os.path.join( |
| 25 GetChromiumDir(), 'third_party', 'catapult', 'catapult_base') |
| 26 if catapult_base_path not in sys.path: |
| 27 sys.path.insert(1, catapult_base_path) |
| 12 | 28 |
| 13 from catapult_base import cloud_storage | 29 from catapult_base import cloud_storage |
| 14 from telemetry import benchmark_runner | 30 from telemetry import benchmark_runner |
| 15 | 31 |
| 16 | 32 |
| 17 def _GetPerfDir(*subdirs): | |
| 18 perf_dir = os.path.realpath(os.path.dirname(__file__)) | |
| 19 return os.path.join(perf_dir, *subdirs) | |
| 20 | |
| 21 | |
| 22 def GetChromiumDir(): | |
| 23 return _GetPerfDir(os.path.pardir, os.path.pardir, os.path.pardir) | |
| 24 | |
| 25 | |
| 26 def _FetchDependenciesIfNeeded(story_set): | 33 def _FetchDependenciesIfNeeded(story_set): |
| 27 """ Download files needed by a user story set. """ | 34 """ Download files needed by a user story set. """ |
| 28 # Download files in serving_dirs. | 35 # Download files in serving_dirs. |
| 29 serving_dirs = story_set.serving_dirs | 36 serving_dirs = story_set.serving_dirs |
| 30 for directory in serving_dirs: | 37 for directory in serving_dirs: |
| 31 cloud_storage.GetFilesInDirectoryIfChanged(directory, story_set.bucket) | 38 cloud_storage.GetFilesInDirectoryIfChanged(directory, story_set.bucket) |
| 32 | 39 |
| 33 # Download WPR files. | 40 # Download WPR files. |
| 34 if any(not story.is_local for story in story_set): | 41 if any(not story.is_local for story in story_set): |
| 35 story_set.wpr_archive_info.DownloadArchivesIfNeeded() | 42 story_set.wpr_archive_info.DownloadArchivesIfNeeded() |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 deps = _EnumerateDependencies(story_set) | 92 deps = _EnumerateDependencies(story_set) |
| 86 for dep in deps: | 93 for dep in deps: |
| 87 print >> output, dep | 94 print >> output, dep |
| 88 | 95 |
| 89 | 96 |
| 90 if __name__ == '__main__': | 97 if __name__ == '__main__': |
| 91 if len(sys.argv) != 2 or sys.argv[1][0] == '-': | 98 if len(sys.argv) != 2 or sys.argv[1][0] == '-': |
| 92 _show_usage() | 99 _show_usage() |
| 93 else: | 100 else: |
| 94 main() | 101 main() |
| OLD | NEW |