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

Side by Side Diff: tools/skpbench/_adb_path.py

Issue 2481413003: skpbench: simplify adb and reduce number of invocations (Closed)
Patch Set: skpbench: simplify adb and reduce number of invocations Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « tools/skpbench/_adb.py ('k') | tools/skpbench/_hardware_android.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 Google Inc. 1 # Copyright 2016 Google Inc.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 from _adb import Adb 6 from _adb import Adb
7 import re 7 import re
8 import subprocess 8 import subprocess
9 9
10 __ADB = None 10 __ADB = None
11 11
12 def init(device_serial): 12 def init(device_serial):
13 global __ADB 13 global __ADB
14 __ADB = Adb(device_serial) 14 __ADB = Adb(device_serial)
15 15
16 def join(*pathnames): 16 def join(*pathnames):
17 return '/'.join(pathnames) 17 return '/'.join(pathnames)
18 18
19 def basename(pathname): 19 def basename(pathname):
20 return pathname.rsplit('/', maxsplit=1)[-1] 20 return pathname.rsplit('/', maxsplit=1)[-1]
21 21
22 def find_skps(skps): 22 def find_skps(skps):
23 escapedskps = [re.sub(r'([^a-zA-Z0-9_/\.\*\?\[\!\]])', r'\\\1', x) 23 escapedskps = [re.sub(r'([^a-zA-Z0-9_/\.\*\?\[\!\]])', r'\\\1', x)
24 for x in skps] 24 for x in skps]
25 return __ADB.check_lines('''\ 25 return __ADB.check('''\
26 for PATHNAME in %s; do 26 for PATHNAME in %s; do
27 if [ -d "$PATHNAME" ]; then 27 if [ -d "$PATHNAME" ]; then
28 find "$PATHNAME" -maxdepth 1 -name *.skp 28 find "$PATHNAME" -maxdepth 1 -name *.skp
29 else 29 else
30 echo "$PATHNAME" 30 echo "$PATHNAME"
31 fi 31 fi
32 done''' % ' '.join(escapedskps)) 32 done''' % ' '.join(escapedskps)).splitlines()
OLDNEW
« no previous file with comments | « tools/skpbench/_adb.py ('k') | tools/skpbench/_hardware_android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698