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 |
11 import logging | 11 import logging |
12 import os | 12 import os |
13 import sys | 13 import sys |
14 | 14 |
15 import devil_chromium | |
16 | |
17 from devil.android import apk_helper | 15 from devil.android import apk_helper |
18 from devil.android import device_blacklist | 16 from devil.android import device_blacklist |
19 from devil.android import device_errors | 17 from devil.android import device_errors |
20 from devil.android import device_utils | 18 from devil.android import device_utils |
21 from devil.utils import run_tests_helper | 19 from devil.utils import run_tests_helper |
22 from pylib import constants | 20 from pylib import constants |
23 | 21 |
24 | 22 |
25 def main(): | 23 def main(): |
26 parser = argparse.ArgumentParser() | 24 parser = argparse.ArgumentParser() |
(...skipping 30 matching lines...) Expand all Loading... |
57 help='Target device for apk to install on.') | 55 help='Target device for apk to install on.') |
58 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') | 56 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') |
59 parser.add_argument('-v', '--verbose', action='count', | 57 parser.add_argument('-v', '--verbose', action='count', |
60 help='Enable verbose logging.') | 58 help='Enable verbose logging.') |
61 | 59 |
62 args = parser.parse_args() | 60 args = parser.parse_args() |
63 | 61 |
64 run_tests_helper.SetLogLevel(args.verbose) | 62 run_tests_helper.SetLogLevel(args.verbose) |
65 constants.SetBuildType(args.build_type) | 63 constants.SetBuildType(args.build_type) |
66 | 64 |
67 devil_chromium.Initialize(output_directory=constants.GetOutDirectory()) | |
68 | |
69 apk = args.apk_path or args.apk_name | 65 apk = args.apk_path or args.apk_name |
70 if not apk.endswith('.apk'): | 66 if not apk.endswith('.apk'): |
71 apk += '.apk' | 67 apk += '.apk' |
72 if not os.path.exists(apk): | 68 if not os.path.exists(apk): |
73 apk = os.path.join(constants.GetOutDirectory(), 'apks', apk) | 69 apk = os.path.join(constants.GetOutDirectory(), 'apks', apk) |
74 if not os.path.exists(apk): | 70 if not os.path.exists(apk): |
75 parser.error('%s not found.' % apk) | 71 parser.error('%s not found.' % apk) |
76 | 72 |
77 if args.splits: | 73 if args.splits: |
78 splits = [] | 74 splits = [] |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if blacklist: | 111 if blacklist: |
116 blacklist.Extend([str(device)]) | 112 blacklist.Extend([str(device)]) |
117 logging.warning('Blacklisting %s', str(device)) | 113 logging.warning('Blacklisting %s', str(device)) |
118 | 114 |
119 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) | 115 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) |
120 | 116 |
121 | 117 |
122 if __name__ == '__main__': | 118 if __name__ == '__main__': |
123 sys.exit(main()) | 119 sys.exit(main()) |
124 | 120 |
OLD | NEW |