Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: tools/skpbench/_adb_path.py

Issue 2350003002: Add adb support to skpbench (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/skpbench/_adb.py ('k') | tools/skpbench/_os_path.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skpbench/_adb_path.py
diff --git a/tools/skpbench/_adb_path.py b/tools/skpbench/_adb_path.py
new file mode 100644
index 0000000000000000000000000000000000000000..377ba12490f3308607c658bf6969794dea5d8686
--- /dev/null
+++ b/tools/skpbench/_adb_path.py
@@ -0,0 +1,33 @@
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import _adb
+import re
+import subprocess
+
+__ADB_DEVICE_SERIAL = None
+
+def set_device_serial(device_serial):
+ global __ADB_DEVICE_SERIAL
+ __ADB_DEVICE_SERIAL = device_serial
+
+def join(*pathnames):
+ return '/'.join(pathnames)
+
+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.
+ for x in skps]
+ pathnames = _adb.check('''
+ 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)
« no previous file with comments | « tools/skpbench/_adb.py ('k') | tools/skpbench/_os_path.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698