| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 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 """Insert a version string into a library as a section '.chromium.version'. | 7 """Insert a version string into a library as a section '.chromium.version'. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import ast |
| 10 import optparse | 11 import optparse |
| 11 import os | 12 import os |
| 12 import sys | 13 import sys |
| 13 import tempfile | 14 import tempfile |
| 14 | 15 |
| 15 from util import build_utils | 16 from util import build_utils |
| 16 | 17 |
| 17 def InsertChromiumVersion(android_objcopy, | 18 def InsertChromiumVersion(android_objcopy, |
| 18 library_path, | 19 library_path, |
| 19 version_string): | 20 version_string): |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 | 35 |
| 35 def main(args): | 36 def main(args): |
| 36 args = build_utils.ExpandFileArgs(args) | 37 args = build_utils.ExpandFileArgs(args) |
| 37 parser = optparse.OptionParser() | 38 parser = optparse.OptionParser() |
| 38 | 39 |
| 39 parser.add_option('--android-objcopy', | 40 parser.add_option('--android-objcopy', |
| 40 help='Path to the toolchain\'s objcopy binary') | 41 help='Path to the toolchain\'s objcopy binary') |
| 41 parser.add_option('--stripped-libraries-dir', | 42 parser.add_option('--stripped-libraries-dir', |
| 42 help='Directory of native libraries') | 43 help='Directory of native libraries') |
| 43 parser.add_option('--libraries', | 44 parser.add_option('--libraries', |
| 44 help='List of libraries') | 45 help='List of libraries in Python list format') |
| 45 parser.add_option('--version-string', | 46 parser.add_option('--version-string', |
| 46 help='Version string to be inserted') | 47 help='Version string to be inserted') |
| 47 parser.add_option('--stamp', help='Path to touch on success') | 48 parser.add_option('--stamp', help='Path to touch on success') |
| 48 | 49 |
| 49 options, _ = parser.parse_args(args) | 50 options, _ = parser.parse_args(args) |
| 50 libraries = build_utils.ParseGypList(options.libraries) | 51 libraries = ast.literal_eval(options.libraries) |
| 51 | 52 |
| 52 for library in libraries: | 53 for library in libraries: |
| 53 library_path = os.path.join(options.stripped_libraries_dir, library) | 54 library_path = os.path.join(options.stripped_libraries_dir, library) |
| 54 | 55 |
| 55 InsertChromiumVersion(options.android_objcopy, | 56 InsertChromiumVersion(options.android_objcopy, |
| 56 library_path, | 57 library_path, |
| 57 options.version_string) | 58 options.version_string) |
| 58 | 59 |
| 59 if options.stamp: | 60 if options.stamp: |
| 60 build_utils.Touch(options.stamp) | 61 build_utils.Touch(options.stamp) |
| 61 | 62 |
| 62 return 0 | 63 return 0 |
| 63 | 64 |
| 64 | 65 |
| 65 if __name__ == '__main__': | 66 if __name__ == '__main__': |
| 66 sys.exit(main(sys.argv[1:])) | 67 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |