Chromium Code Reviews| Index: build/android/adb_install_apk.py |
| diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..5ec34c8917c1f786a33d579f4c88aa493f0442e2 |
| --- /dev/null |
| +++ b/build/android/adb_install_apk.py |
| @@ -0,0 +1,51 @@ |
| +#!/usr/bin/env python |
| +# |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from multiprocessing import Process |
| +import optparse |
| +import os |
| +import sys |
| + |
| +from pylib import android_commands |
| +from pylib import test_options_parser |
| +from pylib import constants |
| + |
| + |
| +def InstallApk(device, options): |
| + apk_path = os.path.join(os.environ['CHROME_SRC'], |
| + 'out', options.build_type, |
| + 'apks', options.apk) |
| + result = android_commands.AndroidCommands(device=device).ManagedInstall( |
| + apk_path, False, options.apk_package) |
| + print '----- Installed on %s -----' % device |
| + print result |
| + |
| + |
| +def main(argv): |
| + parser = optparse.OptionParser() |
| + test_options_parser.AddBuildTypeOption(parser) |
| + test_options_parser.AddInstallAPKOption(parser) |
| + options, args = parser.parse_args(argv) |
| + |
| + if len(args) > 1: |
| + raise Exception('Error: Unknown argument:', args[1:]) |
| + |
| + devices = android_commands.GetAttachedDevices() |
| + if not devices: |
| + raise Exception('Error: no connected devices') |
| + |
| + procs = [] |
| + for device in devices: |
| + p = Process(target=InstallApk, |
| + args=(device, options)) |
| + p.start() |
| + procs += [p] |
| + |
| + for p in procs: |
| + p.join() |
|
bulach
2012/10/02 10:40:46
would something like this work?
all_args = [(devi
klundberg
2012/10/02 18:40:06
Done.
|
| + |
|
bulach
2012/10/02 10:40:46
nit: need an extra \n here
klundberg
2012/10/02 18:40:06
Done.
|
| +if __name__ == '__main__': |
| + sys.exit(main(sys.argv)) |