OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 """Installs an APK. |
| 8 |
| 9 """ |
| 10 |
| 11 import optparse |
| 12 import os |
| 13 import subprocess |
| 14 import sys |
| 15 |
| 16 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') |
| 17 sys.path.append(BUILD_ANDROID_DIR) |
| 18 |
| 19 from pylib import build_utils |
| 20 |
| 21 |
| 22 def main(argv): |
| 23 parser = optparse.OptionParser() |
| 24 parser.add_option('--android-sdk-tools', |
| 25 help='Path to Android SDK tools.') |
| 26 parser.add_option('--apk-path', |
| 27 help='Path to .apk to install.') |
| 28 parser.add_option('--stamp', |
| 29 help='Path to touch on success.') |
| 30 options, _ = parser.parse_args() |
| 31 |
| 32 # TODO(cjhopman): Should this install to all devices/be configurable? |
| 33 install_cmd = [ |
| 34 os.path.join(options.android_sdk_tools, 'adb'), |
| 35 'install', '-r', |
| 36 options.apk_path] |
| 37 |
| 38 subprocess.check_call(install_cmd) |
| 39 |
| 40 if options.stamp: |
| 41 build_utils.Touch(options.stamp) |
| 42 |
| 43 |
| 44 if __name__ == '__main__': |
| 45 sys.exit(main(sys.argv)) |
OLD | NEW |