skia2/tools/skpbench/_adb_path.py
Chris Dalton 117d9729c1 skpbench: Add support for Pixel 2
Bug: skia:
Change-Id: Ic0901ca84bf8e3fda29b3bd7a0504396445ca0f4
Reviewed-on: https://skia-review.googlesource.com/124282
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2018-04-30 15:29:13 +00:00

35 lines
844 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):
# root first, in case skps reside in a protected directory
__ADB.root()
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()