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

Side by Side Diff: build/android/gyp/apk_install.py

Issue 17335010: Print a nicer error if installing an APK fails when you have not run adb root. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 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 """Installs an APK. 7 """Installs an APK.
8 8
9 """ 9 """
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return True 42 return True
43 43
44 with open(metadata_path, 'r') as expected_file: 44 with open(metadata_path, 'r') as expected_file:
45 return expected_file.read() != GetMetadata(apk_package) 45 return expected_file.read() != GetMetadata(apk_package)
46 46
47 47
48 def RecordInstallMetadata(apk_package, metadata_path): 48 def RecordInstallMetadata(apk_package, metadata_path):
49 """Records the metadata from the device for apk_package.""" 49 """Records the metadata from the device for apk_package."""
50 metadata = GetMetadata(apk_package) 50 metadata = GetMetadata(apk_package)
51 if not metadata: 51 if not metadata:
52 raise 'APK install failed unexpectedly.' 52 if not android_commands.AndroidCommands().IsRootEnabled():
53 raise Exception('APK install failed unexpectedly -- root not enabled on '
54 'the device (run adb root).')
55 raise Exception('APK install failed unexpectedly.')
53 56
54 with open(metadata_path, 'w') as outfile: 57 with open(metadata_path, 'w') as outfile:
55 outfile.write(metadata) 58 outfile.write(metadata)
56 59
57 60
58 def main(argv): 61 def main(argv):
59 if not build_utils.IsDeviceReady(): 62 if not build_utils.IsDeviceReady():
60 build_utils.PrintBigWarning( 63 build_utils.PrintBigWarning(
61 'Zero (or multiple) devices attached. Skipping APK install.') 64 'Zero (or multiple) devices attached. Skipping APK install.')
62 return 65 return
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 input_paths=[options.apk_path], 103 input_paths=[options.apk_path],
101 input_strings=install_cmd, 104 input_strings=install_cmd,
102 force=force_install) 105 force=force_install)
103 106
104 if options.stamp: 107 if options.stamp:
105 build_utils.Touch(options.stamp) 108 build_utils.Touch(options.stamp)
106 109
107 110
108 if __name__ == '__main__': 111 if __name__ == '__main__':
109 sys.exit(main(sys.argv)) 112 sys.exit(main(sys.argv))
OLDNEW
« 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