Bug 1236467 - [mozdevice] raise exception when missing devices access permissions. r=ahal

Also bump the version to 0.48.

--HG--
extra : rebase_source : a79be8684a51a529a6b163c9bac378a199ab6961
This commit is contained in:
Julien Pagès 2016-01-04 16:29:36 +01:00
Родитель 5fce4f1216
Коммит c6fd260e95
2 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -67,6 +67,16 @@ class ADBError(Exception):
"""
pass
class ADBListDevicesError(ADBError):
"""ADBListDevicesError is raised when errors are found listing the
devices, typically not any permissions.
The devices information is stocked with the *devices* member.
"""
def __init__(self, msg, devices):
ADBError.__init__(self, msg)
self.devices = devices
class ADBRootError(Exception):
"""ADBRootError is raised when a shell command is to be executed as
root but the device does not support it. This error is fatal since
@ -432,6 +442,7 @@ class ADBHost(ADBCommand):
:type timeout: integer or None
:returns: an object contain
:raises: * ADBTimeoutError
* ADBListDevicesError
* ADBError
The output of adb devices -l ::
@ -468,6 +479,14 @@ class ADBHost(ADBCommand):
self._logger.warning('devices: Unable to parse '
'remainder for device %s' % line)
devices.append(device)
for device in devices:
if device['state'] == 'no permissions':
raise ADBListDevicesError(
"No permissions to detect devices. You should restart the"
" adb server as root:\n"
"\n# adb kill-server\n# adb start-server\n"
"\nor maybe configure your udev rules.",
devices)
return devices

Просмотреть файл

@ -5,7 +5,7 @@
from setuptools import setup
PACKAGE_NAME = 'mozdevice'
PACKAGE_VERSION = '0.47'
PACKAGE_VERSION = '0.48'
deps = ['mozfile >= 1.0',
'mozlog >= 3.0',