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

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

Issue 106923002: Don't use sys.exit() in build_utils.CheckCallDie(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 """Combines stripped libraries and incomplete APK into single standalone APK. 7 """Combines stripped libraries and incomplete APK into single standalone APK.
8 8
9 """ 9 """
10 10
11 import optparse 11 import optparse
12 import os 12 import os
13 import shutil 13 import shutil
14 import sys 14 import sys
15 import tempfile 15 import tempfile
16 16
17 from util import build_utils 17 from util import build_utils
18 from util import md5_check 18 from util import md5_check
19 19
20 def CreateStandaloneApk(options): 20 def CreateStandaloneApk(options):
21 def DoZip(): 21 def DoZip():
22 with tempfile.NamedTemporaryFile(suffix='.zip') as intermediate_file: 22 with tempfile.NamedTemporaryFile(suffix='.zip') as intermediate_file:
23 intermediate_path = intermediate_file.name 23 intermediate_path = intermediate_file.name
24 shutil.copy(options.input_apk_path, intermediate_path) 24 shutil.copy(options.input_apk_path, intermediate_path)
25 apk_path_abs = os.path.abspath(intermediate_path) 25 apk_path_abs = os.path.abspath(intermediate_path)
26 build_utils.CheckCallDie( 26 build_utils.CheckOutput(
27 ['zip', '-r', '-1', apk_path_abs, 'lib'], 27 ['zip', '-r', '-1', apk_path_abs, 'lib'],
28 cwd=options.libraries_top_dir, 28 cwd=options.libraries_top_dir)
29 suppress_output=True)
30 shutil.copy(intermediate_path, options.output_apk_path) 29 shutil.copy(intermediate_path, options.output_apk_path)
31 30
32 input_paths = [options.input_apk_path, options.libraries_top_dir] 31 input_paths = [options.input_apk_path, options.libraries_top_dir]
33 record_path = '%s.standalone.stamp' % options.input_apk_path 32 record_path = '%s.standalone.stamp' % options.input_apk_path
34 md5_check.CallAndRecordIfStale( 33 md5_check.CallAndRecordIfStale(
35 DoZip, 34 DoZip,
36 record_path=record_path, 35 record_path=record_path,
37 input_paths=input_paths) 36 input_paths=input_paths)
38 37
39 38
(...skipping 12 matching lines...) Expand all
52 build_utils.CheckOptions(options, parser, required=required_options) 51 build_utils.CheckOptions(options, parser, required=required_options)
53 52
54 CreateStandaloneApk(options) 53 CreateStandaloneApk(options)
55 54
56 if options.stamp: 55 if options.stamp:
57 build_utils.Touch(options.stamp) 56 build_utils.Touch(options.stamp)
58 57
59 58
60 if __name__ == '__main__': 59 if __name__ == '__main__':
61 sys.exit(main(sys.argv)) 60 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698