| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """ A simple device interface for build steps. | 5 """ A simple device interface for build steps. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| 11 import re | 11 import re |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 import build_utils # pylint: disable=F0401 | 14 import build_utils # pylint: disable=F0401 |
| 15 | 15 |
| 16 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..', '..') | 16 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..', '..') |
| 17 sys.path.append(BUILD_ANDROID_DIR) | 17 sys.path.append(BUILD_ANDROID_DIR) |
| 18 | 18 |
| 19 from pylib import android_commands | 19 from pylib import android_commands |
| 20 # While this isn't used in this file, it is used in some files that import it. | |
| 21 from pylib.android_commands import GetAttachedDevices # pylint: disable=W0611 | |
| 22 | 20 |
| 23 | 21 |
| 24 class BuildDevice(object): | 22 class BuildDevice(object): |
| 25 def __init__(self, configuration): | 23 def __init__(self, configuration): |
| 26 self.id = configuration['id'] | 24 self.id = configuration['id'] |
| 27 self.description = configuration['description'] | 25 self.description = configuration['description'] |
| 28 self.install_metadata = configuration['install_metadata'] | 26 self.install_metadata = configuration['install_metadata'] |
| 29 self.adb = android_commands.AndroidCommands(self.id) | 27 self.adb = android_commands.AndroidCommands(self.id) |
| 30 | 28 |
| 31 def RunShellCommand(self, *args, **kwargs): | 29 def RunShellCommand(self, *args, **kwargs): |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 assert len(configurations) == 1 | 87 assert len(configurations) == 1 |
| 90 return BuildDevice(configurations[0]) | 88 return BuildDevice(configurations[0]) |
| 91 | 89 |
| 92 | 90 |
| 93 def GetBuildDeviceFromPath(path): | 91 def GetBuildDeviceFromPath(path): |
| 94 configurations = ReadConfigurations(path) | 92 configurations = ReadConfigurations(path) |
| 95 if len(configurations) > 0: | 93 if len(configurations) > 0: |
| 96 return GetBuildDevice(ReadConfigurations(path)) | 94 return GetBuildDevice(ReadConfigurations(path)) |
| 97 return None | 95 return None |
| 98 | 96 |
| OLD | NEW |