f7cf794890
Change-Id: I6009dfc7c6eabe04b3b6fdf68f38995d718b4fef Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235278 Commit-Queue: Nathaniel Nifong <nifong@google.com> Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
35 lines
864 B
Python
35 lines
864 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' -o -name '*.mskp'
|
|
else
|
|
echo "$PATHNAME"
|
|
fi
|
|
done''' % ' '.join(escapedskps)).splitlines()
|