OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import argparse | 6 import argparse |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import skypy.paths | 10 import skypy.paths |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 dev_null = open(os.devnull, 'w') # Leaking. | 51 dev_null = open(os.devnull, 'w') # Leaking. |
52 to_pull = set(filter(None, map(library_from_line, maps_lines))) | 52 to_pull = set(filter(None, map(library_from_line, maps_lines))) |
53 to_pull.add('/system/bin/linker') # Unclear why but adb_gdb pulls this too. | 53 to_pull.add('/system/bin/linker') # Unclear why but adb_gdb pulls this too. |
54 for library_path in sorted(to_pull): | 54 for library_path in sorted(to_pull): |
55 # Not using os.path.join since library_path is absolute. | 55 # Not using os.path.join since library_path is absolute. |
56 dest_file = os.path.normpath("%s/%s" % (args.cache_root, library_path)) | 56 dest_file = os.path.normpath("%s/%s" % (args.cache_root, library_path)) |
57 dest_dir = os.path.dirname(dest_file) | 57 dest_dir = os.path.dirname(dest_file) |
58 if not os.path.exists(dest_dir): | 58 if not os.path.exists(dest_dir): |
59 os.makedirs(dest_dir) | 59 os.makedirs(dest_dir) |
| 60 if os.path.exists(dest_file): |
| 61 continue |
60 print '%s -> %s' % (library_path, dest_file) | 62 print '%s -> %s' % (library_path, dest_file) |
61 pull_cmd = [ADB_PATH, 'pull', library_path, dest_file] | 63 pull_cmd = [ADB_PATH, 'pull', library_path, dest_file] |
62 subprocess.check_call(pull_cmd, stderr=dev_null) | 64 subprocess.check_call(pull_cmd, stderr=dev_null) |
63 | 65 |
64 | 66 |
65 if __name__ == '__main__': | 67 if __name__ == '__main__': |
66 main() | 68 main() |
OLD | NEW |