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 re | 13 import re |
14 import subprocess | |
15 import sys | 14 import sys |
16 | 15 |
17 from util import build_device | 16 from util import build_device |
18 from util import build_utils | 17 from util import build_utils |
19 from util import md5_check | 18 from util import md5_check |
20 | 19 |
21 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') | 20 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') |
22 sys.path.append(BUILD_ANDROID_DIR) | 21 sys.path.append(BUILD_ANDROID_DIR) |
23 | 22 |
24 from pylib import constants | 23 from pylib import constants |
(...skipping 23 matching lines...) Expand all Loading... |
48 def RecordInstallMetadata(device, apk_package, metadata_path): | 47 def RecordInstallMetadata(device, apk_package, metadata_path): |
49 """Records the metadata from the device for apk_package.""" | 48 """Records the metadata from the device for apk_package.""" |
50 metadata = GetNewMetadata(device, apk_package) | 49 metadata = GetNewMetadata(device, apk_package) |
51 if not metadata: | 50 if not metadata: |
52 raise Exception('APK install failed unexpectedly.') | 51 raise Exception('APK install failed unexpectedly.') |
53 | 52 |
54 with open(metadata_path, 'w') as outfile: | 53 with open(metadata_path, 'w') as outfile: |
55 outfile.write(metadata) | 54 outfile.write(metadata) |
56 | 55 |
57 | 56 |
58 def main(argv): | 57 def main(): |
59 parser = optparse.OptionParser() | 58 parser = optparse.OptionParser() |
60 parser.add_option('--apk-path', | 59 parser.add_option('--apk-path', |
61 help='Path to .apk to install.') | 60 help='Path to .apk to install.') |
62 parser.add_option('--install-record', | 61 parser.add_option('--install-record', |
63 help='Path to install record (touched only when APK is installed).') | 62 help='Path to install record (touched only when APK is installed).') |
64 parser.add_option('--build-device-configuration', | 63 parser.add_option('--build-device-configuration', |
65 help='Path to build device configuration.') | 64 help='Path to build device configuration.') |
66 parser.add_option('--stamp', | 65 parser.add_option('--stamp', |
67 help='Path to touch on success.') | 66 help='Path to touch on success.') |
68 parser.add_option('--configuration-name', | 67 parser.add_option('--configuration-name', |
(...skipping 27 matching lines...) Expand all Loading... |
96 Install, | 95 Install, |
97 record_path=record_path, | 96 record_path=record_path, |
98 input_paths=[options.apk_path], | 97 input_paths=[options.apk_path], |
99 force=force_install) | 98 force=force_install) |
100 | 99 |
101 if options.stamp: | 100 if options.stamp: |
102 build_utils.Touch(options.stamp) | 101 build_utils.Touch(options.stamp) |
103 | 102 |
104 | 103 |
105 if __name__ == '__main__': | 104 if __name__ == '__main__': |
106 sys.exit(main(sys.argv)) | 105 sys.exit(main()) |
OLD | NEW |