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

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

Issue 153743008: Revert of Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging with changes to pylib/linker/test_case.py. Created 6 years, 10 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 | « build/android/gyp/emma_instr.py ('k') | build/android/gyp/gcc_preprocess.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 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 """Signs and zipaligns APK. 6 """Signs and zipaligns APK.
7 7
8 """ 8 """
9 9
10 import optparse 10 import optparse
11 import os 11 import os
12 import shutil 12 import shutil
13 import sys 13 import sys
14 import tempfile 14 import tempfile
15 15
16 from util import build_utils # pylint: disable=F0401 16 from util import build_utils
17 17
18 def SignApk(keystore_path, unsigned_path, signed_path): 18 def SignApk(keystore_path, unsigned_path, signed_path):
19 shutil.copy(unsigned_path, signed_path) 19 shutil.copy(unsigned_path, signed_path)
20 sign_cmd = [ 20 sign_cmd = [
21 'jarsigner', 21 'jarsigner',
22 '-sigalg', 'MD5withRSA', 22 '-sigalg', 'MD5withRSA',
23 '-digestalg', 'SHA1', 23 '-digestalg', 'SHA1',
24 '-keystore', keystore_path, 24 '-keystore', keystore_path,
25 '-storepass', 'chromium', 25 '-storepass', 'chromium',
26 signed_path, 26 signed_path,
27 'chromiumdebugkey', 27 'chromiumdebugkey',
28 ] 28 ]
29 build_utils.CheckOutput(sign_cmd) 29 build_utils.CheckOutput(sign_cmd)
30 30
31 31
32 def AlignApk(android_sdk_root, unaligned_path, final_path): 32 def AlignApk(android_sdk_root, unaligned_path, final_path):
33 align_cmd = [ 33 align_cmd = [
34 os.path.join(android_sdk_root, 'tools', 'zipalign'), 34 os.path.join(android_sdk_root, 'tools', 'zipalign'),
35 '-f', '4', # 4 bytes 35 '-f', '4', # 4 bytes
36 unaligned_path, 36 unaligned_path,
37 final_path, 37 final_path,
38 ] 38 ]
39 build_utils.CheckOutput(align_cmd) 39 build_utils.CheckOutput(align_cmd)
40 40
41 41
42 def main(): 42 def main(argv):
43 parser = optparse.OptionParser() 43 parser = optparse.OptionParser()
44 44
45 parser.add_option('--android-sdk-root', help='Android sdk root directory.') 45 parser.add_option('--android-sdk-root', help='Android sdk root directory.')
46 parser.add_option('--unsigned-apk-path', help='Path to input unsigned APK.') 46 parser.add_option('--unsigned-apk-path', help='Path to input unsigned APK.')
47 parser.add_option('--final-apk-path', 47 parser.add_option('--final-apk-path',
48 help='Path to output signed and aligned APK.') 48 help='Path to output signed and aligned APK.')
49 parser.add_option('--keystore-path', help='Path to keystore for signing.') 49 parser.add_option('--keystore-path', help='Path to keystore for signing.')
50 parser.add_option('--stamp', help='Path to touch on success.') 50 parser.add_option('--stamp', help='Path to touch on success.')
51 51
52 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. 52 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
53 parser.add_option('--ignore', help='Ignored.') 53 parser.add_option('--ignore', help='Ignored.')
54 54
55 options, _ = parser.parse_args() 55 options, _ = parser.parse_args()
56 56
57 with tempfile.NamedTemporaryFile() as intermediate_file: 57 with tempfile.NamedTemporaryFile() as intermediate_file:
58 signed_apk_path = intermediate_file.name 58 signed_apk_path = intermediate_file.name
59 SignApk(options.keystore_path, options.unsigned_apk_path, signed_apk_path) 59 SignApk(options.keystore_path, options.unsigned_apk_path, signed_apk_path)
60 AlignApk(options.android_sdk_root, signed_apk_path, options.final_apk_path) 60 AlignApk(options.android_sdk_root, signed_apk_path, options.final_apk_path)
61 61
62 if options.stamp: 62 if options.stamp:
63 build_utils.Touch(options.stamp) 63 build_utils.Touch(options.stamp)
64 64
65 65
66 if __name__ == '__main__': 66 if __name__ == '__main__':
67 sys.exit(main()) 67 sys.exit(main(sys.argv))
68 68
69 69
OLDNEW
« no previous file with comments | « build/android/gyp/emma_instr.py ('k') | build/android/gyp/gcc_preprocess.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698