| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 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 """Provisions Android devices with settings required for bots. | 7 """Provisions Android devices with settings required for bots. |
| 8 | 8 |
| 9 Usage: | 9 Usage: |
| 10 ./provision_devices.py [-d <device serial number>] | 10 ./provision_devices.py [-d <device serial number>] |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 class _PHASES(object): | 47 class _PHASES(object): |
| 48 WIPE = 'wipe' | 48 WIPE = 'wipe' |
| 49 PROPERTIES = 'properties' | 49 PROPERTIES = 'properties' |
| 50 FINISH = 'finish' | 50 FINISH = 'finish' |
| 51 | 51 |
| 52 ALL = [WIPE, PROPERTIES, FINISH] | 52 ALL = [WIPE, PROPERTIES, FINISH] |
| 53 | 53 |
| 54 | 54 |
| 55 def ProvisionDevices(args): | 55 def ProvisionDevices(args): |
| 56 blacklist = (device_blacklist.Blacklist(args.blacklist_file) | 56 if args.blacklist_file: |
| 57 if args.blacklist_file | 57 blacklist = device_blacklist.Blacklist(args.blacklist_file) |
| 58 else None) | 58 else: |
| 59 # TODO(jbudorick): Remove once the bots have switched over. |
| 60 blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) |
| 59 | 61 |
| 60 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 62 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
| 61 if args.device: | 63 if args.device: |
| 62 devices = [d for d in devices if d == args.device] | 64 devices = [d for d in devices if d == args.device] |
| 63 if not devices: | 65 if not devices: |
| 64 raise device_errors.DeviceUnreachableError(args.device) | 66 raise device_errors.DeviceUnreachableError(args.device) |
| 65 | 67 |
| 66 parallel_devices = device_utils.DeviceUtils.parallel(devices) | 68 parallel_devices = device_utils.DeviceUtils.parallel(devices) |
| 67 parallel_devices.pMap(ProvisionDevice, blacklist, args) | 69 parallel_devices.pMap(ProvisionDevice, blacklist, args) |
| 68 if args.auto_reconnect: | 70 if args.auto_reconnect: |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 args = parser.parse_args() | 450 args = parser.parse_args() |
| 449 constants.SetBuildType(args.target) | 451 constants.SetBuildType(args.target) |
| 450 | 452 |
| 451 run_tests_helper.SetLogLevel(args.verbose) | 453 run_tests_helper.SetLogLevel(args.verbose) |
| 452 | 454 |
| 453 return ProvisionDevices(args) | 455 return ProvisionDevices(args) |
| 454 | 456 |
| 455 | 457 |
| 456 if __name__ == '__main__': | 458 if __name__ == '__main__': |
| 457 sys.exit(main()) | 459 sys.exit(main()) |
| OLD | NEW |