| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 logging | 5 import logging |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from py_utils import binary_manager | 8 from py_utils import binary_manager |
| 9 from py_utils import dependency_util | 9 from py_utils import dependency_util |
| 10 import dependency_manager | 10 import dependency_manager |
| 11 from devil import devil_env | 11 from devil import devil_env |
| 12 | 12 |
| 13 from telemetry.core import exceptions | 13 from telemetry.core import exceptions |
| 14 from telemetry.core import util | 14 from telemetry.core import util |
| 15 from telemetry.core import platform as platform_module | 15 from telemetry.core import platform as platform_module |
| 16 | 16 |
| 17 import sys |
| 17 | 18 |
| 18 TELEMETRY_PROJECT_CONFIG = os.path.join( | 19 TELEMETRY_PROJECT_CONFIG = os.path.join( |
| 19 util.GetTelemetryDir(), 'telemetry', 'internal', 'binary_dependencies.json') | 20 util.GetTelemetryDir(), 'telemetry', 'internal', 'binary_dependencies.json') |
| 20 | 21 |
| 21 | 22 |
| 22 CHROME_BINARY_CONFIG = os.path.join(util.GetCatapultDir(), 'common', 'py_utils', | 23 CHROME_BINARY_CONFIG = os.path.join(util.GetCatapultDir(), 'common', 'py_utils', |
| 23 'py_utils', 'chrome_binaries.json') | 24 'py_utils', 'chrome_binaries.json') |
| 24 | 25 |
| 25 | 26 |
| 26 BATTOR_BINARY_CONFIG = os.path.join(util.GetCatapultDir(), 'common', 'battor', | 27 BATTOR_BINARY_CONFIG = os.path.join(util.GetCatapultDir(), 'common', 'battor', |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 if _binary_manager: | 44 if _binary_manager: |
| 44 raise exceptions.InitializationError( | 45 raise exceptions.InitializationError( |
| 45 'Trying to re-initialize the binary manager with config %s' | 46 'Trying to re-initialize the binary manager with config %s' |
| 46 % client_configs) | 47 % client_configs) |
| 47 configs = [] | 48 configs = [] |
| 48 if client_configs: | 49 if client_configs: |
| 49 configs += client_configs | 50 configs += client_configs |
| 50 configs += [TELEMETRY_PROJECT_CONFIG, CHROME_BINARY_CONFIG] | 51 configs += [TELEMETRY_PROJECT_CONFIG, CHROME_BINARY_CONFIG] |
| 51 _binary_manager = binary_manager.BinaryManager(configs) | 52 _binary_manager = binary_manager.BinaryManager(configs) |
| 52 | 53 |
| 54 if "devil_chromium" in sys.modules: |
| 55 for chromium_out_dir in util.GetBuildDirectories(): |
| 56 if os.path.exists(chromium_out_dir): |
| 57 # pylint: disable=undefined-variable |
| 58 devil_chromium.Initialize(output_directory=chromium_out_dir) |
| 59 break |
| 60 |
| 53 devil_env.config.Initialize() | 61 devil_env.config.Initialize() |
| 54 | 62 |
| 55 | 63 |
| 56 def FetchPath(binary_name, arch, os_name, os_version=None): | 64 def FetchPath(binary_name, arch, os_name, os_version=None): |
| 57 """ Return a path to the appropriate executable for <binary_name>, downloading | 65 """ Return a path to the appropriate executable for <binary_name>, downloading |
| 58 from cloud storage if needed, or None if it cannot be found. | 66 from cloud storage if needed, or None if it cannot be found. |
| 59 """ | 67 """ |
| 60 if _binary_manager is None: | 68 if _binary_manager is None: |
| 61 raise exceptions.InitializationError( | 69 raise exceptions.InitializationError( |
| 62 'Called FetchPath with uninitialized binary manager.') | 70 'Called FetchPath with uninitialized binary manager.') |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 manager = binary_manager.BinaryManager( | 152 manager = binary_manager.BinaryManager( |
| 145 [CHROME_BINARY_CONFIG]) | 153 [CHROME_BINARY_CONFIG]) |
| 146 if os_name == 'android': | 154 if os_name == 'android': |
| 147 os_version = dependency_util.GetChromeApkOsVersion( | 155 os_version = dependency_util.GetChromeApkOsVersion( |
| 148 platform.GetOSVersionName()) | 156 platform.GetOSVersionName()) |
| 149 manager.FetchPath( | 157 manager.FetchPath( |
| 150 'chrome_stable', os_name, arch_name, os_version) | 158 'chrome_stable', os_name, arch_name, os_version) |
| 151 else: | 159 else: |
| 152 manager.FetchPath( | 160 manager.FetchPath( |
| 153 'chrome_stable', os_name, arch_name) | 161 'chrome_stable', os_name, arch_name) |
| OLD | NEW |