Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: build/android/adb_install_apk.py

Issue 1088793002: [Android] Remove android_commands uses from build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: docstrings for device_filter.py Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/android/adb_reverse_forwarder.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 optparse 9 import optparse
10 import os 10 import os
11 import sys 11 import sys
12 12
13 from pylib import android_commands
14 from pylib import constants 13 from pylib import constants
14 from pylib.device import adb_wrapper
15 from pylib.device import device_filter
15 from pylib.device import device_utils 16 from pylib.device import device_utils
16 17
17 18
18 def AddInstallAPKOption(option_parser): 19 def AddInstallAPKOption(option_parser):
19 """Adds apk option used to install the APK to the OptionParser.""" 20 """Adds apk option used to install the APK to the OptionParser."""
20 option_parser.add_option('--apk', 21 option_parser.add_option('--apk',
21 help=('DEPRECATED The name of the apk containing the' 22 help=('DEPRECATED The name of the apk containing the'
22 ' application (with the .apk extension).')) 23 ' application (with the .apk extension).'))
23 option_parser.add_option('--apk_package', 24 option_parser.add_option('--apk_package',
24 help=('DEPRECATED The package name used by the apk ' 25 help=('DEPRECATED The package name used by the apk '
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 options, args = parser.parse_args(argv) 65 options, args = parser.parse_args(argv)
65 66
66 if len(args) > 1 and options.apk: 67 if len(args) > 1 and options.apk:
67 parser.error("Appending the apk as argument can't be used with --apk.") 68 parser.error("Appending the apk as argument can't be used with --apk.")
68 elif len(args) > 2: 69 elif len(args) > 2:
69 parser.error("Too many arguments.") 70 parser.error("Too many arguments.")
70 71
71 constants.SetBuildType(options.build_type) 72 constants.SetBuildType(options.build_type)
72 ValidateInstallAPKOption(parser, options, args) 73 ValidateInstallAPKOption(parser, options, args)
73 74
74 devices = android_commands.GetAttachedDevices() 75 devices = adb_wrapper.AdbWrapper.Devices(
76 filters=device_filter.DefaultFilters())
75 77
76 if options.device: 78 if options.device:
77 if options.device not in devices: 79 if options.device not in [d.GetDeviceSerial() for d in devices]:
78 raise Exception('Error: %s not in attached devices %s' % (options.device, 80 raise Exception('Error: %s not in attached devices %s' % (options.device,
79 ','.join(devices))) 81 ','.join(devices)))
80 devices = [options.device] 82 devices = [options.device]
81 83
82 if not devices: 84 if not devices:
83 raise Exception('Error: no connected devices') 85 raise Exception('Error: no connected devices')
84 86
85 device_utils.DeviceUtils.parallel(devices).Install( 87 device_utils.DeviceUtils.parallel(devices).Install(
86 options.apk, reinstall=options.keep_data) 88 options.apk, reinstall=options.keep_data)
87 89
88 90
89 if __name__ == '__main__': 91 if __name__ == '__main__':
90 sys.exit(main(sys.argv)) 92 sys.exit(main(sys.argv))
91 93
OLDNEW
« no previous file with comments | « no previous file | build/android/adb_reverse_forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698