| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 """Utility script to install APKs from the command line quickly.""" | 7 """Utility script to install APKs from the command line quickly.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import glob | 10 import glob |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 def blacklisting_install(device): | 98 def blacklisting_install(device): |
| 99 try: | 99 try: |
| 100 if args.splits: | 100 if args.splits: |
| 101 device.InstallSplitApk(apk, splits, reinstall=args.keep_data) | 101 device.InstallSplitApk(apk, splits, reinstall=args.keep_data) |
| 102 else: | 102 else: |
| 103 device.Install(apk, reinstall=args.keep_data) | 103 device.Install(apk, reinstall=args.keep_data) |
| 104 except device_errors.CommandFailedError: | 104 except device_errors.CommandFailedError: |
| 105 logging.exception('Failed to install %s', args.apk_name) | 105 logging.exception('Failed to install %s', args.apk_name) |
| 106 if blacklist: | 106 if blacklist: |
| 107 blacklist.Extend([str(device)]) | 107 blacklist.Extend([str(device)], reason='install_failure') |
| 108 logging.warning('Blacklisting %s', str(device)) | 108 logging.warning('Blacklisting %s', str(device)) |
| 109 except device_errors.CommandTimeoutError: | 109 except device_errors.CommandTimeoutError: |
| 110 logging.exception('Timed out while installing %s', args.apk_name) | 110 logging.exception('Timed out while installing %s', args.apk_name) |
| 111 if blacklist: | 111 if blacklist: |
| 112 blacklist.Extend([str(device)]) | 112 blacklist.Extend([str(device)], reason='install_timeout') |
| 113 logging.warning('Blacklisting %s', str(device)) | 113 logging.warning('Blacklisting %s', str(device)) |
| 114 | 114 |
| 115 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) | 115 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) |
| 116 | 116 |
| 117 | 117 |
| 118 if __name__ == '__main__': | 118 if __name__ == '__main__': |
| 119 sys.exit(main()) | 119 sys.exit(main()) |
| 120 | 120 |
| OLD | NEW |