| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 except IOError: | 297 except IOError: |
| 298 # Older toolchains didn't have the VS_VERSION file, and used 'win8sdk' | 298 # Older toolchains didn't have the VS_VERSION file, and used 'win8sdk' |
| 299 # instead of just 'win_sdk'. | 299 # instead of just 'win_sdk'. |
| 300 vs_version = '2013' | 300 vs_version = '2013' |
| 301 win_sdk = os.path.join(abs_target_dir, 'win8sdk') | 301 win_sdk = os.path.join(abs_target_dir, 'win8sdk') |
| 302 | 302 |
| 303 data = { | 303 data = { |
| 304 'path': abs_target_dir, | 304 'path': abs_target_dir, |
| 305 'version': vs_version, | 305 'version': vs_version, |
| 306 'win_sdk': win_sdk, | 306 'win_sdk': win_sdk, |
| 307 # Added for backwards compatibility with old toolchain packages. |
| 308 'win8sdk': win_sdk, |
| 307 'wdk': os.path.join(abs_target_dir, 'wdk'), | 309 'wdk': os.path.join(abs_target_dir, 'wdk'), |
| 308 'runtime_dirs': [ | 310 'runtime_dirs': [ |
| 309 os.path.join(abs_target_dir, 'sys64'), | 311 os.path.join(abs_target_dir, 'sys64'), |
| 310 os.path.join(abs_target_dir, 'sys32'), | 312 os.path.join(abs_target_dir, 'sys32'), |
| 311 ], | 313 ], |
| 312 } | 314 } |
| 313 with open(os.path.join(target_dir, '..', 'data.json'), 'w') as f: | 315 with open(os.path.join(target_dir, '..', 'data.json'), 'w') as f: |
| 314 json.dump(data, f) | 316 json.dump(data, f) |
| 315 | 317 |
| 316 if got_new_toolchain: | 318 if got_new_toolchain: |
| 317 current_hash = CalculateHash(target_dir) | 319 current_hash = CalculateHash(target_dir) |
| 318 if current_hash not in desired_hashes: | 320 if current_hash not in desired_hashes: |
| 319 print >> sys.stderr, ( | 321 print >> sys.stderr, ( |
| 320 'Got wrong hash after pulling a new toolchain. ' | 322 'Got wrong hash after pulling a new toolchain. ' |
| 321 'Wanted one of \'%s\', got \'%s\'.' % ( | 323 'Wanted one of \'%s\', got \'%s\'.' % ( |
| 322 ', '.join(desired_hashes), current_hash)) | 324 ', '.join(desired_hashes), current_hash)) |
| 323 return 1 | 325 return 1 |
| 324 SaveTimestampsAndHash(target_dir, current_hash) | 326 SaveTimestampsAndHash(target_dir, current_hash) |
| 325 | 327 |
| 326 if options.output_json: | 328 if options.output_json: |
| 327 shutil.copyfile(os.path.join(target_dir, '..', 'data.json'), | 329 shutil.copyfile(os.path.join(target_dir, '..', 'data.json'), |
| 328 options.output_json) | 330 options.output_json) |
| 329 | 331 |
| 330 return 0 | 332 return 0 |
| 331 | 333 |
| 332 | 334 |
| 333 if __name__ == '__main__': | 335 if __name__ == '__main__': |
| 334 sys.exit(main()) | 336 sys.exit(main()) |
| OLD | NEW |