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

Unified Diff: build/android/adb_install_apk.py

Issue 286423002: Make adb_install_apk.py saner for humans. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@android_build_cleanup
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_install_apk.py
diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py
index b5a0be16d420d083394a4cf9165a0354f880b1b7..e9df938ca1b7526024b6dd92238690849fc4920f 100755
--- a/build/android/adb_install_apk.py
+++ b/build/android/adb_install_apk.py
@@ -37,7 +37,7 @@ def AddInstallAPKOption(option_parser):
AddBuildTypeOption(option_parser)
option_parser.add_option('--apk',
- help=('The name of the apk containing the '
+ help=('DEPRECATED The name of the apk containing the'
' application (with the .apk extension).'))
option_parser.add_option('--apk_package',
help=('The package name used by the apk containing '
@@ -49,10 +49,18 @@ def AddInstallAPKOption(option_parser):
'the application.'))
-def ValidateInstallAPKOption(option_parser, options):
+def ValidateInstallAPKOption(option_parser, options, args):
"""Validates the apk option and potentially qualifies the path."""
if not options.apk:
- option_parser.error('--apk is mandatory.')
+ if len(args) > 1:
+ options.apk = args[1]
+ else:
+ option_parser.error('apk target not specified.')
+ return
+
+ if not options.apk.endswith(".apk"):
bulach 2014/05/19 10:22:36 nit: here and below, s/"/'/
mlamouri (slow - plz ping) 2014/05/19 13:43:01 Done.
+ options.apk += ".apk"
+
if not os.path.exists(options.apk):
options.apk = os.path.join(constants.GetOutDirectory(), 'apks',
options.apk)
@@ -67,12 +75,17 @@ def _InstallApk(args):
def main(argv):
parser = optparse.OptionParser()
+ parser.set_usage("usage: %prog [options] target")
AddInstallAPKOption(parser)
options, args = parser.parse_args(argv)
+
+ if len(args) > 1 and options.apk:
+ parser.error("Appending the apk as argument can't be used with --apk.")
+ elif len(args) > 2:
+ parser.error("Too many arguments.")
+
constants.SetBuildType(options.build_type)
- ValidateInstallAPKOption(parser, options)
- if len(args) > 1:
- raise Exception('Error: Unknown argument:', args[1:])
+ ValidateInstallAPKOption(parser, options, args)
devices = android_commands.GetAttachedDevices()
if not devices:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698