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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 matches = False | 132 matches = False |
133 break | 133 break |
134 elif os.path.exists(timestamps_file): | 134 elif os.path.exists(timestamps_file): |
135 # Print some information about the extra/missing files. Don't do this if we | 135 # Print some information about the extra/missing files. Don't do this if we |
136 # don't have a timestamp file, as all the files will be considered as | 136 # don't have a timestamp file, as all the files will be considered as |
137 # missing. | 137 # missing. |
138 timestamps_data_files = [] | 138 timestamps_data_files = [] |
139 for f in timestamps_data['files']: | 139 for f in timestamps_data['files']: |
140 timestamps_data_files.append(f[0]) | 140 timestamps_data_files.append(f[0]) |
141 missing_files = [f for f in timestamps_data_files if f not in file_list] | 141 missing_files = [f for f in timestamps_data_files if f not in file_list] |
142 if len(missing_files): | 142 if len(missing_files): |
scottmg
2016/06/23 16:45:24
These two duplicated blocks almost look like they
Sébastien Marchand
2016/06/23 17:41:45
Yeah, I thought about this but it seemed a little
| |
143 print ('Some files are missing from the %s version of the toolchain:' % | 143 print ('%d files missing from the %s version of the toolchain:' % |
144 expected_hash) | 144 (len(missing_files), expected_hash)) |
145 for f in missing_files: | 145 for f in missing_files[:10]: |
146 print '\t%s' % f | 146 print '\t%s' % f |
147 if len(missing_files) > 10: | |
148 print '\t...' | |
147 extra_files = [f for f in file_list if f not in timestamps_data_files] | 149 extra_files = [f for f in file_list if f not in timestamps_data_files] |
148 if len(extra_files): | 150 if len(extra_files): |
149 print ('There\'s some extra files in the %s version of the toolchain:' % | 151 print ('%d extra files in the %s version of the toolchain:' % |
150 expected_hash) | 152 (len(extra_files), expected_hash)) |
151 for f in extra_files: | 153 for f in extra_files[:10]: |
152 print '\t%s' % f | 154 print '\t%s' % f |
155 if len(extra_files) > 10: | |
156 print '\t...' | |
153 if matches: | 157 if matches: |
154 return timestamps_data['sha1'] | 158 return timestamps_data['sha1'] |
155 | 159 |
156 # Make long hangs when updating the toolchain less mysterious. | 160 # Make long hangs when updating the toolchain less mysterious. |
157 print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path | 161 print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path |
158 sys.stdout.flush() | 162 sys.stdout.flush() |
159 digest = hashlib.sha1() | 163 digest = hashlib.sha1() |
160 for path in file_list: | 164 for path in file_list: |
161 path_without_hash = str(path).replace('/', '\\') | 165 path_without_hash = str(path).replace('/', '\\') |
162 if expected_hash: | 166 if expected_hash: |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 if os.environ.get('GYP_MSVS_VERSION') == '2015': | 544 if os.environ.get('GYP_MSVS_VERSION') == '2015': |
541 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) | 545 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) |
542 | 546 |
543 RemoveUnusedToolchains(target_dir) | 547 RemoveUnusedToolchains(target_dir) |
544 | 548 |
545 return 0 | 549 return 0 |
546 | 550 |
547 | 551 |
548 if __name__ == '__main__': | 552 if __name__ == '__main__': |
549 sys.exit(main()) | 553 sys.exit(main()) |
OLD | NEW |