OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # | |
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 | |
5 # found in the LICENSE file. | |
6 | |
7 import multiprocessing | |
8 import optparse | |
9 import os | |
10 import sys | |
11 | |
12 from pylib import android_commands | |
13 from pylib import test_options_parser | |
14 from pylib import constants | |
15 | |
16 | |
17 def InstallApk(args): | |
Isaac (away)
2012/10/02 19:29:59
suggest changing this to:
def InstallApk(options,
klundberg
2012/10/02 21:01:03
As discussed in person, just changing the line bel
| |
18 options = args[0] | |
19 device = args[1] | |
20 apk_path = os.path.join(os.environ['CHROME_SRC'], | |
21 'out', options.build_type, | |
22 'apks', options.apk) | |
23 result = android_commands.AndroidCommands(device=device).ManagedInstall( | |
24 apk_path, False, options.apk_package) | |
25 print '----- Installed on %s -----' % device | |
26 print result | |
27 | |
28 | |
29 def main(argv): | |
30 parser = optparse.OptionParser() | |
31 test_options_parser.AddBuildTypeOption(parser) | |
32 test_options_parser.AddInstallAPKOption(parser) | |
33 options, args = parser.parse_args(argv) | |
34 | |
35 if len(args) > 1: | |
36 raise Exception('Error: Unknown argument:', args[1:]) | |
37 | |
38 devices = android_commands.GetAttachedDevices() | |
39 if not devices: | |
40 raise Exception('Error: no connected devices') | |
41 | |
42 pool = multiprocessing.Pool(len(devices)) | |
43 # Send a tuple (options, device) per instance of DeploySingleDevice. | |
44 pool.map(InstallApk, zip([options] * len(devices), devices)) | |
Isaac (away)
2012/10/02 19:29:59
change this to pool.imap and you can eliminate the
klundberg
2012/10/02 21:01:03
As discussed (and tried) in person, this doesn't w
| |
45 | |
46 | |
47 if __name__ == '__main__': | |
48 sys.exit(main(sys.argv)) | |
OLD | NEW |