Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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): |
| 143 print ('Some files are missing from the %s version of the toolchain:' % | 143 print ('%d file%s missing from the %s version of the toolchain:' % |
| 144 expected_hash) | 144 (len(missing_files), 's are' if len(missing_files) > 1 else '', |
|
Nico
2016/06/23 15:53:45
nit: i'd just say "%d files missing", it's not lik
Sébastien Marchand
2016/06/23 15:57:51
Done.
| |
| 145 for f in missing_files: | 145 expected_hash)) |
| 146 print '\t%s' % f | 146 for i in xrange(0, min(len(missing_files), 10)): |
| 147 print '\t%s' % missing_files[i] | |
| 148 if len(missing_files) > 10: | |
| 149 print '\t...' | |
| 147 extra_files = [f for f in file_list if f not in timestamps_data_files] | 150 extra_files = [f for f in file_list if f not in timestamps_data_files] |
| 148 if len(extra_files): | 151 if len(extra_files): |
| 149 print ('There\'s some extra files in the %s version of the toolchain:' % | 152 print ('There\'s %d extra file%s in the %s version of the toolchain:' % |
|
Nico
2016/06/23 15:53:44
same nit: drop "There's", and i'd always just say
Sébastien Marchand
2016/06/23 15:57:51
Done.
| |
| 150 expected_hash) | 153 (len(extra_files), 's' if len(missing_files) > 1 else '', |
| 151 for f in extra_files: | 154 expected_hash)) |
| 152 print '\t%s' % f | 155 for i in xrange(0, min(len(extra_files), 10)): |
| 156 print '\t%s' % extra_files[i] | |
| 157 if len(extra_files) > 10: | |
| 158 print '\t...' | |
| 153 if matches: | 159 if matches: |
| 154 return timestamps_data['sha1'] | 160 return timestamps_data['sha1'] |
| 155 | 161 |
| 156 # Make long hangs when updating the toolchain less mysterious. | 162 # Make long hangs when updating the toolchain less mysterious. |
| 157 print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path | 163 print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path |
| 158 sys.stdout.flush() | 164 sys.stdout.flush() |
| 159 digest = hashlib.sha1() | 165 digest = hashlib.sha1() |
| 160 for path in file_list: | 166 for path in file_list: |
| 161 path_without_hash = str(path).replace('/', '\\') | 167 path_without_hash = str(path).replace('/', '\\') |
| 162 if expected_hash: | 168 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': | 546 if os.environ.get('GYP_MSVS_VERSION') == '2015': |
| 541 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) | 547 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) |
| 542 | 548 |
| 543 RemoveUnusedToolchains(target_dir) | 549 RemoveUnusedToolchains(target_dir) |
| 544 | 550 |
| 545 return 0 | 551 return 0 |
| 546 | 552 |
| 547 | 553 |
| 548 if __name__ == '__main__': | 554 if __name__ == '__main__': |
| 549 sys.exit(main()) | 555 sys.exit(main()) |
| OLD | NEW |