| 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 21 matching lines...) Expand all Loading... |
| 46 def RecordInstallMetadata(device, apk_package, metadata_path): | 45 def RecordInstallMetadata(device, apk_package, metadata_path): |
| 47 """Records the metadata from the device for apk_package.""" | 46 """Records the metadata from the device for apk_package.""" |
| 48 metadata = GetNewMetadata(device, apk_package) | 47 metadata = GetNewMetadata(device, apk_package) |
| 49 if not metadata: | 48 if not metadata: |
| 50 raise Exception('APK install failed unexpectedly.') | 49 raise Exception('APK install failed unexpectedly.') |
| 51 | 50 |
| 52 with open(metadata_path, 'w') as outfile: | 51 with open(metadata_path, 'w') as outfile: |
| 53 outfile.write(metadata) | 52 outfile.write(metadata) |
| 54 | 53 |
| 55 | 54 |
| 56 def main(argv): | 55 def main(): |
| 57 parser = optparse.OptionParser() | 56 parser = optparse.OptionParser() |
| 58 parser.add_option('--apk-path', | 57 parser.add_option('--apk-path', |
| 59 help='Path to .apk to install.') | 58 help='Path to .apk to install.') |
| 60 parser.add_option('--install-record', | 59 parser.add_option('--install-record', |
| 61 help='Path to install record (touched only when APK is installed).') | 60 help='Path to install record (touched only when APK is installed).') |
| 62 parser.add_option('--build-device-configuration', | 61 parser.add_option('--build-device-configuration', |
| 63 help='Path to build device configuration.') | 62 help='Path to build device configuration.') |
| 64 parser.add_option('--stamp', | 63 parser.add_option('--stamp', |
| 65 help='Path to touch on success.') | 64 help='Path to touch on success.') |
| 66 parser.add_option('--configuration-name', | 65 parser.add_option('--configuration-name', |
| (...skipping 27 matching lines...) Expand all Loading... |
| 94 Install, | 93 Install, |
| 95 record_path=record_path, | 94 record_path=record_path, |
| 96 input_paths=[options.apk_path], | 95 input_paths=[options.apk_path], |
| 97 force=force_install) | 96 force=force_install) |
| 98 | 97 |
| 99 if options.stamp: | 98 if options.stamp: |
| 100 build_utils.Touch(options.stamp) | 99 build_utils.Touch(options.stamp) |
| 101 | 100 |
| 102 | 101 |
| 103 if __name__ == '__main__': | 102 if __name__ == '__main__': |
| 104 sys.exit(main(sys.argv)) | 103 sys.exit(main()) |
| OLD | NEW |