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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 for split_glob in args.splits: | 76 for split_glob in args.splits: |
77 apks = [f for f in glob.glob(split_glob) if f.endswith('.apk')] | 77 apks = [f for f in glob.glob(split_glob) if f.endswith('.apk')] |
78 if not apks: | 78 if not apks: |
79 logging.warning('No apks matched for %s.', split_glob) | 79 logging.warning('No apks matched for %s.', split_glob) |
80 for f in apks: | 80 for f in apks: |
81 helper = apk_helper.ApkHelper(f) | 81 helper = apk_helper.ApkHelper(f) |
82 if (helper.GetPackageName() == base_apk_package | 82 if (helper.GetPackageName() == base_apk_package |
83 and helper.GetSplitName()): | 83 and helper.GetSplitName()): |
84 splits.append(f) | 84 splits.append(f) |
85 | 85 |
86 blacklist = (device_blacklist.Blacklist(args.blacklist_file) | 86 if args.blacklist_file: |
87 if args.blacklist_file | 87 blacklist = device_blacklist.Blacklist(args.blacklist_file) |
88 else None) | 88 else: |
| 89 # TODO(jbudorick): Remove this once the bots are converted. |
| 90 blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) |
| 91 |
89 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 92 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
90 | 93 |
91 if args.device: | 94 if args.device: |
92 devices = [d for d in devices if d == args.device] | 95 devices = [d for d in devices if d == args.device] |
93 if not devices: | 96 if not devices: |
94 raise device_errors.DeviceUnreachableError(args.device) | 97 raise device_errors.DeviceUnreachableError(args.device) |
95 elif not devices: | 98 elif not devices: |
96 raise device_errors.NoDevicesError() | 99 raise device_errors.NoDevicesError() |
97 | 100 |
98 def blacklisting_install(device): | 101 def blacklisting_install(device): |
(...skipping 12 matching lines...) Expand all Loading... |
111 if blacklist: | 114 if blacklist: |
112 blacklist.Extend([str(device)]) | 115 blacklist.Extend([str(device)]) |
113 logging.warning('Blacklisting %s', str(device)) | 116 logging.warning('Blacklisting %s', str(device)) |
114 | 117 |
115 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) | 118 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) |
116 | 119 |
117 | 120 |
118 if __name__ == '__main__': | 121 if __name__ == '__main__': |
119 sys.exit(main()) | 122 sys.exit(main()) |
120 | 123 |
OLD | NEW |