Index: tools/skpbench/_adb_path.py |
diff --git a/tools/skpbench/_adb_path.py b/tools/skpbench/_adb_path.py |
index 377ba12490f3308607c658bf6969794dea5d8686..47eb7de17eddca702792c59b03a36fb16379a5ff 100644 |
--- a/tools/skpbench/_adb_path.py |
+++ b/tools/skpbench/_adb_path.py |
@@ -3,15 +3,15 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import _adb |
+from _adb import Adb |
import re |
import subprocess |
-__ADB_DEVICE_SERIAL = None |
+__ADB = None |
-def set_device_serial(device_serial): |
- global __ADB_DEVICE_SERIAL |
- __ADB_DEVICE_SERIAL = device_serial |
+def init(device_serial): |
+ global __ADB |
+ __ADB = Adb(device_serial) |
def join(*pathnames): |
return '/'.join(pathnames) |
@@ -20,14 +20,13 @@ def basename(pathname): |
return pathname.rsplit('/', maxsplit=1)[-1] |
def find_skps(skps): |
- escapedskps = [re.sub(r'([^a-zA-Z0-9_\*\?\[\!\]])', r'\\\1', x) # Keep globs. |
+ escapedskps = [re.sub(r'([^a-zA-Z0-9_/\.\*\?\[\!\]])', r'\\\1', x) |
for x in skps] |
- pathnames = _adb.check(''' |
+ return __ADB.check_lines('''\ |
for PATHNAME in %s; do |
if [ -d "$PATHNAME" ]; then |
ls "$PATHNAME"/*.skp |
else |
echo "$PATHNAME" |
fi |
- done''' % ' '.join(escapedskps), device_serial=__ADB_DEVICE_SERIAL) |
- return re.split('[\r\n]+', pathnames) |
+ done''' % ' '.join(escapedskps)) |