зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1522661 - [mozdevice 4.0.1] adb should use ANDROID_SERIAL environment variable if device not otherwise specified. r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D86401
This commit is contained in:
Родитель
73764ca6a5
Коммит
325e7ba955
|
@ -236,7 +236,8 @@ class ADBCommand(object):
|
|||
executed.
|
||||
:param str device_serial: The device's
|
||||
serial number if the adb command is to be executed against
|
||||
a specific device.
|
||||
a specific device. If it is not specified, ANDROID_SERIAL
|
||||
from the environment will be used if it is set.
|
||||
:param int timeout: The maximum time in
|
||||
seconds for any spawned adb process to complete before
|
||||
throwing an ADBTimeoutError. This timeout is per adb call. The
|
||||
|
@ -263,6 +264,7 @@ class ADBCommand(object):
|
|||
the stdout temporary file.
|
||||
"""
|
||||
args = [self._adb_path]
|
||||
device_serial = device_serial or os.environ.get('ANDROID_SERIAL')
|
||||
if self._adb_host:
|
||||
args.extend(['-H', self._adb_host])
|
||||
if self._adb_port:
|
||||
|
@ -298,7 +300,8 @@ class ADBCommand(object):
|
|||
executed.
|
||||
:param str device_serial: The device's
|
||||
serial number if the adb command is to be executed against
|
||||
a specific device.
|
||||
a specific device. If it is not specified, ANDROID_SERIAL
|
||||
from the environment will be used if it is set.
|
||||
:param int timeout: The maximum time in seconds
|
||||
for any spawned adb process to complete before throwing
|
||||
an ADBTimeoutError.
|
||||
|
@ -561,6 +564,7 @@ def ADBDeviceFactory(device=None,
|
|||
:exc:`ADBTimeoutError`
|
||||
|
||||
"""
|
||||
device = device or os.environ.get('ANDROID_SERIAL')
|
||||
if device is not None and device in ADBDEVICES:
|
||||
# We have already created an ADBDevice for this device, just re-use it.
|
||||
adbdevice = ADBDEVICES[device]
|
||||
|
@ -617,7 +621,9 @@ class ADBDevice(ADBCommand):
|
|||
be used to identify the device, otherwise the value of the usb
|
||||
key, prefixed with "usb:" is used. If None is passed and
|
||||
there is exactly one device attached to the host, that device
|
||||
is used. If there is more than one device attached, ValueError
|
||||
is used. If None is passed and ANDROID_SERIAL is set in the environment,
|
||||
that device is used. If there is more than one device attached and
|
||||
device is None and ANDROID_SERIAL is not set in the environment, ValueError
|
||||
is raised. If no device is attached the constructor will block
|
||||
until a device is attached or the timeout is reached.
|
||||
:param str adb_host: host of the adb server to connect to.
|
||||
|
@ -958,6 +964,7 @@ class ADBDevice(ADBCommand):
|
|||
raise ADBError('Failed to complete boot in time')
|
||||
|
||||
def _get_device_serial(self, device):
|
||||
device = device or os.environ.get('ANDROID_SERIAL')
|
||||
if device is None:
|
||||
devices = ADBHost(adb=self._adb_path, adb_host=self._adb_host,
|
||||
adb_port=self._adb_port).devices()
|
||||
|
|
|
@ -8,7 +8,7 @@ from __future__ import absolute_import
|
|||
from setuptools import setup
|
||||
|
||||
PACKAGE_NAME = 'mozdevice'
|
||||
PACKAGE_VERSION = '4.0.0'
|
||||
PACKAGE_VERSION = '4.0.1'
|
||||
|
||||
deps = ['mozlog >= 6.0']
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче