OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 Google Inc. |
| 2 # |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import _adb |
| 7 import re |
| 8 import subprocess |
| 9 |
| 10 __ADB_DEVICE_SERIAL = None |
| 11 |
| 12 def set_device_serial(device_serial): |
| 13 global __ADB_DEVICE_SERIAL |
| 14 __ADB_DEVICE_SERIAL = device_serial |
| 15 |
| 16 def join(*pathnames): |
| 17 return '/'.join(pathnames) |
| 18 |
| 19 def basename(pathname): |
| 20 return pathname.rsplit('/', maxsplit=1)[-1] |
| 21 |
| 22 def find_skps(skps): |
| 23 escapedskps = [re.sub(r'([^a-zA-Z0-9_\*\?\[\!\]])', r'\\\1', x) # Keep globs. |
| 24 for x in skps] |
| 25 pathnames = _adb.check(''' |
| 26 for PATHNAME in %s; do |
| 27 if [ -d "$PATHNAME" ]; then |
| 28 ls "$PATHNAME"/*.skp |
| 29 else |
| 30 echo "$PATHNAME" |
| 31 fi |
| 32 done''' % ' '.join(escapedskps), device_serial=__ADB_DEVICE_SERIAL) |
| 33 return re.split('[\r\n]+', pathnames) |
OLD | NEW |