| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 apk = os.path.join(constants.GetOutDirectory(), 'apks', apk) | 69 apk = os.path.join(constants.GetOutDirectory(), 'apks', apk) |
| 70 if not os.path.exists(apk): | 70 if not os.path.exists(apk): |
| 71 parser.error('%s not found.' % apk) | 71 parser.error('%s not found.' % apk) |
| 72 | 72 |
| 73 if args.splits: | 73 if args.splits: |
| 74 splits = [] | 74 splits = [] |
| 75 base_apk_package = apk_helper.ApkHelper(apk).GetPackageName() | 75 base_apk_package = apk_helper.ApkHelper(apk).GetPackageName() |
| 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 if args.blacklist_file: | 86 if args.blacklist_file: |
| 87 blacklist = device_blacklist.Blacklist(args.blacklist_file) | 87 blacklist = device_blacklist.Blacklist(args.blacklist_file) |
| 88 else: | 88 else: |
| 89 # TODO(jbudorick): Remove this once the bots are converted. | 89 # TODO(jbudorick): Remove this once the bots are converted. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 114 if blacklist: | 114 if blacklist: |
| 115 blacklist.Extend([str(device)]) | 115 blacklist.Extend([str(device)]) |
| 116 logging.warning('Blacklisting %s', str(device)) | 116 logging.warning('Blacklisting %s', str(device)) |
| 117 | 117 |
| 118 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) | 118 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) |
| 119 | 119 |
| 120 | 120 |
| 121 if __name__ == '__main__': | 121 if __name__ == '__main__': |
| 122 sys.exit(main()) | 122 sys.exit(main()) |
| 123 | 123 |
| OLD | NEW |