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_path = "" | 279 strip_cmdline = ['xcrun', 'strip'] + sys.argv[1:] |
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:] | |
286 strip_cmd = subprocess.Popen(strip_cmdline) | 280 strip_cmd = subprocess.Popen(strip_cmdline) |
287 if strip_cmd.wait() == 0: | 281 if strip_cmd.wait() == 0: |
288 remove_dsym = False | 282 remove_dsym = False |
289 finally: | 283 finally: |
290 if remove_dsym: | 284 if remove_dsym: |
291 shutil.rmtree(dsym) | 285 shutil.rmtree(dsym) |
292 | 286 |
293 # Update modification time on the Mach-O file and .dSYM bundle | 287 # Update modification time on the Mach-O file and .dSYM bundle |
294 now = time.time() | 288 now = time.time() |
295 os.utime(macho, (now, now)) | 289 os.utime(macho, (now, now)) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 print >> sys.stderr, "Nothing to strip" | 326 print >> sys.stderr, "Nothing to strip" |
333 return 1 | 327 return 1 |
334 | 328 |
335 if not strip_and_make_fake_dsym(macho): | 329 if not strip_and_make_fake_dsym(macho): |
336 return 1 | 330 return 1 |
337 | 331 |
338 return 0 | 332 return 0 |
339 | 333 |
340 if __name__ == "__main__": | 334 if __name__ == "__main__": |
341 sys.exit(main(sys.argv)) | 335 sys.exit(main(sys.argv)) |
OLD | NEW |