summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/utils.py b/utils.py
index 0592bfa..38efdce 100644
--- a/utils.py
+++ b/utils.py
@@ -32,7 +32,7 @@ class AndroidDevice(object):
subprocess.check_call(cmd, shell=False, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- def _ExecuteCommand(self, *args):
+ def Execute(self, *args):
"""Executes a command.
Args:
@@ -66,7 +66,7 @@ class AndroidDevice(object):
Raises:
IOError if the command fails.
"""
- out, err, return_code = self._ExecuteCommand("getprop", name)
+ out, err, return_code = self.Execute("getprop", name)
if err.strip() or return_code != 0:
raise IOError("`getprop %s` stdout: %s\nstderr: %s" %
(name, out, err))
@@ -143,14 +143,14 @@ class AndroidDevice(object):
def IsRoot(self):
"""Returns whether adb has root privilege on the device."""
- out, err, return_code = self._ExecuteCommand("id")
+ out, err, return_code = self.Execute("id")
if err.strip() or return_code != 0:
raise IOError("`id` stdout: %s\nstderr: %s \n" % (out, err))
return "uid=0(root)" in out.strip()
def _Test(self, *args):
"""Tests file types and status."""
- out, err, return_code = self._ExecuteCommand("test", *args)
+ out, err, return_code = self.Execute("test", *args)
if out.strip() or err.strip():
raise IOError("`test` args: %s\nstdout: %s\nstderr: %s" %
(args, out, err))
@@ -166,8 +166,7 @@ class AndroidDevice(object):
def _Stat(self, fmt, path):
"""Executes stat command."""
- out, err, return_code = self._ExecuteCommand("stat", "--format", fmt,
- path)
+ out, err, return_code = self.Execute("stat", "--format", fmt, path)
if return_code != 0 or err.strip():
raise IOError("`stat --format %s %s` stdout: %s\nstderr: %s" %
(fmt, path, out, err))
@@ -194,9 +193,9 @@ class AndroidDevice(object):
"""
if '"' in name_pattern or "'" in name_pattern:
raise ValueError("File name pattern contains quotes.")
- out, err, return_code = self._ExecuteCommand("find", path, "-name",
- "'" + name_pattern + "'",
- *options)
+ out, err, return_code = self.Execute("find", path, "-name",
+ "'" + name_pattern + "'",
+ *options)
if return_code != 0 or err.strip():
raise IOError("`find %s -name '%s' %s` stdout: %s\nstderr: %s" %
(path, name_pattern, " ".join(options), out, err))