OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """Downloads and unpacks a toolchain for building on Windows. The contents are | 6 """Downloads and unpacks a toolchain for building on Windows. The contents are |
7 matched by sha1 which will be updated when the toolchain is updated. | 7 matched by sha1 which will be updated when the toolchain is updated. |
8 | 8 |
9 Having a toolchain script in depot_tools means that it's not versioned | 9 Having a toolchain script in depot_tools means that it's not versioned |
10 directly with the source code. That is, if the toolchain is upgraded, but | 10 directly with the source code. That is, if the toolchain is upgraded, but |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if matches: | 116 if matches: |
117 for disk, cached in zip(file_list, timestamps_data['files']): | 117 for disk, cached in zip(file_list, timestamps_data['files']): |
118 if disk != cached[0] or ( | 118 if disk != cached[0] or ( |
119 disk != vc_dir and os.path.getmtime(disk) != cached[1]): | 119 disk != vc_dir and os.path.getmtime(disk) != cached[1]): |
120 matches = False | 120 matches = False |
121 break | 121 break |
122 if matches: | 122 if matches: |
123 return timestamps_data['sha1'] | 123 return timestamps_data['sha1'] |
124 | 124 |
125 # Make long hangs when updating the toolchain less mysterious. | 125 # Make long hangs when updating the toolchain less mysterious. |
126 print 'Calculating hash of toolchain in %s. Please wait...' % root | 126 print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path |
127 sys.stdout.flush() | 127 sys.stdout.flush() |
128 digest = hashlib.sha1() | 128 digest = hashlib.sha1() |
129 for path in file_list: | 129 for path in file_list: |
130 path_without_hash = str(path).replace('/', '\\') | 130 path_without_hash = str(path).replace('/', '\\') |
131 if expected_hash: | 131 if expected_hash: |
132 path_without_hash = path_without_hash.replace( | 132 path_without_hash = path_without_hash.replace( |
133 os.path.join(root, expected_hash), root) | 133 os.path.join(root, expected_hash), root) |
134 digest.update(path_without_hash) | 134 digest.update(path_without_hash) |
135 with open(path, 'rb') as f: | 135 with open(path, 'rb') as f: |
136 digest.update(f.read()) | 136 digest.update(f.read()) |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if os.environ.get('GYP_MSVS_VERSION') == '2015': | 503 if os.environ.get('GYP_MSVS_VERSION') == '2015': |
504 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) | 504 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) |
505 | 505 |
506 RemoveUnusedToolchains(target_dir) | 506 RemoveUnusedToolchains(target_dir) |
507 | 507 |
508 return 0 | 508 return 0 |
509 | 509 |
510 | 510 |
511 if __name__ == '__main__': | 511 if __name__ == '__main__': |
512 sys.exit(main()) | 512 sys.exit(main()) |
OLD | NEW |