| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2008 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 # Usage: strip_save_dsym <whatever-arguments-you-would-pass-to-strip> | 7 # Usage: strip_save_dsym <whatever-arguments-you-would-pass-to-strip> |
| 8 # | 8 # |
| 9 # strip_save_dsym is a wrapper around the standard strip utility. Given an | 9 # strip_save_dsym is a wrapper around the standard strip utility. Given an |
| 10 # input Mach-O file, strip_save_dsym will save a copy of the file in a "fake" | 10 # input Mach-O file, strip_save_dsym will save a copy of the file in a "fake" |
| 11 # .dSYM bundle for debugging, and then call strip to strip the Mach-O file. | 11 # .dSYM bundle for debugging, and then call strip to strip the Mach-O file. |
| 12 # Note that the .dSYM file is a "fake" in that it's not a self-contained | 12 # Note that the .dSYM file is a "fake" in that it's not a self-contained |
| 13 # .dSYM bundle, it just contains a copy of the original (unstripped) Mach-O | 13 # .dSYM bundle, it just contains a copy of the original (unstripped) Mach-O |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 # Strip the Mach-O file | 276 # Strip the Mach-O file |
| 277 remove_dsym = True | 277 remove_dsym = True |
| 278 try: | 278 try: |
| 279 strip_path = "" | 279 strip_path = "" |
| 280 if "SYSTEM_DEVELOPER_BIN_DIR" in os.environ: | 280 if "SYSTEM_DEVELOPER_BIN_DIR" in os.environ: |
| 281 strip_path = os.environ["SYSTEM_DEVELOPER_BIN_DIR"] | 281 strip_path = os.environ["SYSTEM_DEVELOPER_BIN_DIR"] |
| 282 else: | 282 else: |
| 283 strip_path = "/usr/bin" | 283 strip_path = "/usr/bin" |
| 284 strip_path = os.path.join(strip_path, "strip") | 284 strip_path = os.path.join(strip_path, "strip") |
| 285 strip_cmdline = [strip_path] + sys.argv[1:] | 285 strip_cmdline = [strip_path] + sys.argv[1:] |
| 286 # Print the strip invocation so that it's obvious something is happening | |
| 287 print " ".join(strip_cmdline) | |
| 288 strip_cmd = subprocess.Popen(strip_cmdline) | 286 strip_cmd = subprocess.Popen(strip_cmdline) |
| 289 if strip_cmd.wait() == 0: | 287 if strip_cmd.wait() == 0: |
| 290 remove_dsym = False | 288 remove_dsym = False |
| 291 finally: | 289 finally: |
| 292 if remove_dsym: | 290 if remove_dsym: |
| 293 shutil.rmtree(dsym) | 291 shutil.rmtree(dsym) |
| 294 | 292 |
| 295 # Update modification time on the Mach-O file and .dSYM bundle | 293 # Update modification time on the Mach-O file and .dSYM bundle |
| 296 now = time.time() | 294 now = time.time() |
| 297 os.utime(macho, (now, now)) | 295 os.utime(macho, (now, now)) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 print >> sys.stderr, "Nothing to strip" | 332 print >> sys.stderr, "Nothing to strip" |
| 335 return 1 | 333 return 1 |
| 336 | 334 |
| 337 if not strip_and_make_fake_dsym(macho): | 335 if not strip_and_make_fake_dsym(macho): |
| 338 return 1 | 336 return 1 |
| 339 | 337 |
| 340 return 0 | 338 return 0 |
| 341 | 339 |
| 342 if __name__ == "__main__": | 340 if __name__ == "__main__": |
| 343 sys.exit(main(sys.argv)) | 341 sys.exit(main(sys.argv)) |
| OLD | NEW |