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