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

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

Issue 292653003: Move AddBuildTypeOption to adb_install_apk.py and remove test_options_parser.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style fix Created 6 years, 7 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/pylib/utils/test_options_parser.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 multiprocessing 9 import multiprocessing
10 import optparse 10 import optparse
11 import os 11 import os
12 import sys 12 import sys
13 13
14 from pylib import android_commands 14 from pylib import android_commands
15 from pylib import constants 15 from pylib import constants
16 from pylib.device import device_utils 16 from pylib.device import device_utils
17 from pylib.utils import apk_helper 17 from pylib.utils import apk_helper
18 from pylib.utils import test_options_parser 18
19
20 def AddBuildTypeOption(option_parser):
21 """Decorates OptionParser with build type option."""
22 default_build_type = 'Debug'
bulach 2014/05/19 10:19:22 nit: 22-24 can be replaced with: default_build_ty
mlamouri (slow - plz ping) 2014/05/19 13:15:38 Done. I actually moved the content to AddInstallAP
23 if 'BUILDTYPE' in os.environ:
24 default_build_type = os.environ['BUILDTYPE']
25 option_parser.add_option('--debug', action='store_const', const='Debug',
26 dest='build_type', default=default_build_type,
27 help='If set, run test suites under out/Debug. '
28 'Default is env var BUILDTYPE or Debug')
29 option_parser.add_option('--release', action='store_const', const='Release',
30 dest='build_type',
31 help='If set, run test suites under out/Release. '
32 'Default is env var BUILDTYPE or Debug.')
19 33
20 34
21 def AddInstallAPKOption(option_parser): 35 def AddInstallAPKOption(option_parser):
22 """Adds apk option used to install the APK to the OptionParser.""" 36 """Adds apk option used to install the APK to the OptionParser."""
23 test_options_parser.AddBuildTypeOption(option_parser) 37 AddBuildTypeOption(option_parser)
38
24 option_parser.add_option('--apk', 39 option_parser.add_option('--apk',
25 help=('The name of the apk containing the ' 40 help=('The name of the apk containing the '
26 ' application (with the .apk extension).')) 41 ' application (with the .apk extension).'))
27 option_parser.add_option('--apk_package', 42 option_parser.add_option('--apk_package',
28 help=('The package name used by the apk containing ' 43 help=('The package name used by the apk containing '
29 'the application.')) 44 'the application.'))
30 option_parser.add_option('--keep_data', 45 option_parser.add_option('--keep_data',
31 action='store_true', 46 action='store_true',
32 default=False, 47 default=False,
33 help=('Keep the package data when installing ' 48 help=('Keep the package data when installing '
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 pool = multiprocessing.Pool(len(devices)) 84 pool = multiprocessing.Pool(len(devices))
70 # Send a tuple (apk_path, apk_package, device) per device. 85 # Send a tuple (apk_path, apk_package, device) per device.
71 pool.map(_InstallApk, zip([options.apk] * len(devices), 86 pool.map(_InstallApk, zip([options.apk] * len(devices),
72 [options.apk_package] * len(devices), 87 [options.apk_package] * len(devices),
73 [options.keep_data] * len(devices), 88 [options.keep_data] * len(devices),
74 devices)) 89 devices))
75 90
76 91
77 if __name__ == '__main__': 92 if __name__ == '__main__':
78 sys.exit(main(sys.argv)) 93 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/utils/test_options_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698