skia2/tools/skpbench/_adb_path.py
Kevin Lubick cccaef1667 Modify skpbench to use newer adb version
Bug: skia:
NOTRY=true
Change-Id: Ib630d352b6922280ef5772e6843f8f031baeffaf
Reviewed-on: https://skia-review.googlesource.com/59161
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2017-10-13 13:13:47 +00:00

33 lines
768 B
Python

# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from _adb import Adb
import re
import subprocess
__ADB = None
def init(device_serial, adb_binary):
global __ADB
__ADB = Adb(device_serial, adb_binary)
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)
for x in skps]
return __ADB.check('''\
for PATHNAME in %s; do
if [ -d "$PATHNAME" ]; then
find "$PATHNAME" -maxdepth 1 -name *.skp
else
echo "$PATHNAME"
fi
done''' % ' '.join(escapedskps)).splitlines()