зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1310937 - Autophone - mozdevice - sync Bug 1300890 - Autophone - pylint fixes and logging clean up, r=jmaher.
This commit is contained in:
Родитель
b585826937
Коммит
05fec78423
|
@ -683,8 +683,7 @@ class ADBDevice(ADBCommand):
|
|||
|
||||
# Do we need to run adb root to get a root shell?
|
||||
try:
|
||||
if (not self._have_root_shell and
|
||||
self.command_output(
|
||||
if (not self._have_root_shell and self.command_output(
|
||||
["root"],
|
||||
timeout=timeout).find("cannot run as root") == -1):
|
||||
self._have_root_shell = True
|
||||
|
@ -700,7 +699,7 @@ class ADBDevice(ADBCommand):
|
|||
quoted_cmd = []
|
||||
|
||||
for arg in cmd:
|
||||
arg.replace('&', '\&')
|
||||
arg.replace('&', r'\&')
|
||||
|
||||
needs_quoting = False
|
||||
for char in [' ', '(', ')', '"', '&']:
|
||||
|
@ -1579,7 +1578,6 @@ class ADBDevice(ADBCommand):
|
|||
except ADBError:
|
||||
self._logger.error('Ignoring exception in ADBDevice.list_files\n%s' %
|
||||
traceback.format_exc())
|
||||
pass
|
||||
data[:] = [item for item in data if item]
|
||||
self._logger.debug('list_files: %s' % data)
|
||||
return data
|
||||
|
@ -1873,7 +1871,7 @@ class ADBDevice(ADBCommand):
|
|||
adb_process.stdout_file.close()
|
||||
adb_process.stderr_file.close()
|
||||
|
||||
def kill(self, pids, sig=None, attempts=3, wait=5,
|
||||
def kill(self, pids, sig=None, attempts=3, wait=5,
|
||||
timeout=None, root=False):
|
||||
"""Kills processes on the device given a list of process ids.
|
||||
|
||||
|
@ -2186,7 +2184,7 @@ class ADBDevice(ADBCommand):
|
|||
directives = ['battery', 'disk', 'id', 'os', 'process', 'systime',
|
||||
'uptime']
|
||||
|
||||
if (directive in directives):
|
||||
if directive in directives:
|
||||
directives = [directive]
|
||||
|
||||
info = {}
|
||||
|
@ -2208,7 +2206,7 @@ class ADBDevice(ADBCommand):
|
|||
if 'uptime' in directives:
|
||||
uptime = self.shell_output('uptime', timeout=timeout)
|
||||
if uptime:
|
||||
m = re.match('up time: ((\d+) days, )*(\d{2}):(\d{2}):(\d{2})',
|
||||
m = re.match(r'up time: ((\d+) days, )*(\d{2}):(\d{2}):(\d{2})',
|
||||
uptime)
|
||||
if m:
|
||||
uptime = '%d days %d hours %d minutes %d seconds' % tuple(
|
||||
|
|
|
@ -198,9 +198,8 @@ class ADBAndroid(ADBDevice):
|
|||
failure = "Device state: %s" % state
|
||||
success = False
|
||||
else:
|
||||
if (self.selinux and
|
||||
self.shell_output('getenforce',
|
||||
timeout=timeout) != 'Permissive'):
|
||||
if (self.selinux and self.shell_output('getenforce',
|
||||
timeout=timeout) != 'Permissive'):
|
||||
self._logger.info('Setting SELinux Permissive Mode')
|
||||
self.shell_output("setenforce Permissive", timeout=timeout, root=True)
|
||||
if self.is_dir(ready_path, timeout=timeout, root=True):
|
||||
|
@ -341,9 +340,9 @@ class ADBAndroid(ADBDevice):
|
|||
|
||||
if extras:
|
||||
for (key, val) in extras.iteritems():
|
||||
if type(val) is int:
|
||||
if isinstance(val, int):
|
||||
extra_type_param = "--ei"
|
||||
elif type(val) is bool:
|
||||
elif isinstance(val, bool):
|
||||
extra_type_param = "--ez"
|
||||
else:
|
||||
extra_type_param = "--es"
|
||||
|
@ -398,8 +397,8 @@ class ADBAndroid(ADBDevice):
|
|||
if extra_args:
|
||||
extras['args'] = " ".join(extra_args)
|
||||
|
||||
self.launch_application(app_name, "org.mozilla.gecko.BrowserApp", intent, url=url,
|
||||
extras=extras,
|
||||
self.launch_application(app_name, "org.mozilla.gecko.BrowserApp",
|
||||
intent, url=url, extras=extras,
|
||||
wait=wait, fail_if_running=fail_if_running,
|
||||
timeout=timeout)
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class ADBB2G(ADBDevice):
|
|||
timeout=timeout)
|
||||
|
||||
directives = ['memtotal']
|
||||
if (directive in directives):
|
||||
if directive in directives:
|
||||
directives = [directive]
|
||||
|
||||
if 'memtotal' in directives:
|
||||
|
|
Загрузка…
Ссылка в новой задаче