OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # | |
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 | |
5 # found in the LICENSE file. | |
6 | |
7 import optparse | |
8 import os | |
9 import subprocess | |
10 import sys | |
11 | |
12 | |
13 def EnsureDirectoryExists(dir_path): | |
14 try: | |
15 os.makedirs(dir_path) | |
16 except OSError: | |
17 pass | |
18 | |
19 | |
20 def StripLibrary(android_strip, android_strip_args, library_path, output_path): | |
21 strip_cmd = ([android_strip] + | |
22 android_strip_args + | |
23 [library_path, '-o', output_path]) | |
24 subprocess.check_call(strip_cmd) | |
25 | |
26 | |
27 def main(argv): | |
28 parser = optparse.OptionParser() | |
29 | |
30 parser.add_option('--android-strip', action='store') | |
31 parser.add_option('--android-strip-arg', action='append') | |
32 parser.add_option('--libraries-dir', action='store') | |
Yaron
2013/02/25 21:22:55
Could you os.path.dirname to get the library path,
cjhopman
2013/03/07 01:57:26
Done.
| |
33 parser.add_option('--stripped-libraries-dir', action='store') | |
34 parser.add_option('--library-file-name', action='store') | |
35 | |
36 options, args = parser.parse_args() | |
Yaron
2013/02/25 21:22:55
s/args/_/
cjhopman
2013/03/07 01:57:26
Done.
| |
37 | |
38 EnsureDirectoryExists(options.stripped_libraries_dir) | |
39 | |
40 library_path = os.path.join(options.libraries_dir, options.library_file_name) | |
41 stripped_library_path = os.path.join(options.stripped_libraries_dir, | |
42 options.library_file_name) | |
43 | |
44 StripLibrary(options.android_strip, options.android_strip_arg, library_path, | |
45 stripped_library_path) | |
46 | |
47 | |
48 if __name__ == '__main__': | |
49 sys.exit(main(sys.argv)) | |
OLD | NEW |