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 logging | 10 import logging |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 devices = [d for d in devices if d == args.device] | 68 devices = [d for d in devices if d == args.device] |
69 if not devices: | 69 if not devices: |
70 raise device_errors.DeviceUnreachableError(args.device) | 70 raise device_errors.DeviceUnreachableError(args.device) |
71 elif not devices: | 71 elif not devices: |
72 raise device_errors.NoDevicesError() | 72 raise device_errors.NoDevicesError() |
73 | 73 |
74 def blacklisting_install(device): | 74 def blacklisting_install(device): |
75 try: | 75 try: |
76 device.Install(apk, reinstall=args.keep_data) | 76 device.Install(apk, reinstall=args.keep_data) |
77 except device_errors.CommandFailedError: | 77 except device_errors.CommandFailedError: |
78 logging.exception('Failed to install %s', args.apk) | 78 logging.exception('Failed to install %s', args.apk_name) |
79 device_blacklist.ExtendBlacklist([str(device)]) | 79 device_blacklist.ExtendBlacklist([str(device)]) |
80 logging.warning('Blacklisting %s', str(device)) | 80 logging.warning('Blacklisting %s', str(device)) |
81 except device_errors.CommandTimeoutError: | 81 except device_errors.CommandTimeoutError: |
82 logging.exception('Timed out while installing %s', args.apk) | 82 logging.exception('Timed out while installing %s', args.apk_name) |
83 device_blacklist.ExtendBlacklist([str(device)]) | 83 device_blacklist.ExtendBlacklist([str(device)]) |
84 logging.warning('Blacklisting %s', str(device)) | 84 logging.warning('Blacklisting %s', str(device)) |
85 | 85 |
86 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) | 86 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) |
87 | 87 |
88 | 88 |
89 if __name__ == '__main__': | 89 if __name__ == '__main__': |
90 sys.exit(main()) | 90 sys.exit(main()) |
91 | 91 |
OLD | NEW |