OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 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" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 raise | 269 raise |
270 | 270 |
271 if dsym_stat is None or dsym_stat.st_mtime < macho_stat.st_mtime: | 271 if dsym_stat is None or dsym_stat.st_mtime < macho_stat.st_mtime: |
272 # Make a .dSYM bundle | 272 # Make a .dSYM bundle |
273 if not make_fake_dsym(macho, dsym): | 273 if not make_fake_dsym(macho, dsym): |
274 return False | 274 return False |
275 | 275 |
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_cmdline = ['xcrun', 'strip'] + sys.argv[1:] | 279 strip_path = "" |
| 280 if "SYSTEM_DEVELOPER_BIN_DIR" in os.environ: |
| 281 strip_path = os.environ["SYSTEM_DEVELOPER_BIN_DIR"] |
| 282 else: |
| 283 strip_path = "/usr/bin" |
| 284 strip_path = os.path.join(strip_path, "strip") |
| 285 strip_cmdline = [strip_path] + sys.argv[1:] |
280 strip_cmd = subprocess.Popen(strip_cmdline) | 286 strip_cmd = subprocess.Popen(strip_cmdline) |
281 if strip_cmd.wait() == 0: | 287 if strip_cmd.wait() == 0: |
282 remove_dsym = False | 288 remove_dsym = False |
283 finally: | 289 finally: |
284 if remove_dsym: | 290 if remove_dsym: |
285 shutil.rmtree(dsym) | 291 shutil.rmtree(dsym) |
286 | 292 |
287 # Update modification time on the Mach-O file and .dSYM bundle | 293 # Update modification time on the Mach-O file and .dSYM bundle |
288 now = time.time() | 294 now = time.time() |
289 os.utime(macho, (now, now)) | 295 os.utime(macho, (now, now)) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 print >> sys.stderr, "Nothing to strip" | 332 print >> sys.stderr, "Nothing to strip" |
327 return 1 | 333 return 1 |
328 | 334 |
329 if not strip_and_make_fake_dsym(macho): | 335 if not strip_and_make_fake_dsym(macho): |
330 return 1 | 336 return 1 |
331 | 337 |
332 return 0 | 338 return 0 |
333 | 339 |
334 if __name__ == "__main__": | 340 if __name__ == "__main__": |
335 sys.exit(main(sys.argv)) | 341 sys.exit(main(sys.argv)) |
OLD | NEW |