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 """Extracts a Windows VS2013 toolchain from various downloadable pieces.""" | 6 """Extracts a Windows VS2013 toolchain from various downloadable pieces.""" |
7 | 7 |
8 | 8 |
9 import ctypes | 9 import ctypes |
10 import json | 10 import json |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 return result | 337 return result |
338 | 338 |
339 | 339 |
340 def CopyToFinalLocation(extracted_dirs, target_dir): | 340 def CopyToFinalLocation(extracted_dirs, target_dir): |
341 sys.stdout.write('Copying to final location...\n') | 341 sys.stdout.write('Copying to final location...\n') |
342 mappings = { | 342 mappings = { |
343 'Program Files\\Microsoft Visual Studio 12.0\\VC\\': 'VC\\', | 343 'Program Files\\Microsoft Visual Studio 12.0\\VC\\': 'VC\\', |
344 'Program Files\\Microsoft Visual Studio 12.0\\DIA SDK\\': 'DIA SDK\\', | 344 'Program Files\\Microsoft Visual Studio 12.0\\DIA SDK\\': 'DIA SDK\\', |
345 'System64\\': 'sys64\\', | 345 'System64\\': 'sys64\\', |
346 'System\\': 'sys32\\', | 346 'System\\': 'sys32\\', |
347 'Windows Kits\\8.0\\': 'win8sdk\\', | 347 'Windows Kits\\8.1\\': 'win8sdk\\', |
348 'WinDDK\\7600.16385.win7_wdk.100208-1538\\': 'wdk\\', | 348 'WinDDK\\7600.16385.win7_wdk.100208-1538\\': 'wdk\\', |
349 } | 349 } |
350 matches = [] | 350 matches = [] |
351 for extracted_dir in extracted_dirs: | 351 for extracted_dir in extracted_dirs: |
352 for root, _, filenames in os.walk(extracted_dir): | 352 for root, _, filenames in os.walk(extracted_dir): |
353 for filename in filenames: | 353 for filename in filenames: |
354 matches.append((extracted_dir, os.path.join(root, filename))) | 354 matches.append((extracted_dir, os.path.join(root, filename))) |
355 | 355 |
356 copies = [] | 356 copies = [] |
357 for prefix, full_path in matches: | 357 for prefix, full_path in matches: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 # host at all). | 391 # host at all). |
392 if pro: | 392 if pro: |
393 f.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' | 393 f.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' |
394 '%~dp0..\\..\\VC\\bin\\amd64_x86;' | 394 '%~dp0..\\..\\VC\\bin\\amd64_x86;' |
395 '%~dp0..\\..\\VC\\bin\\amd64;' # Needed for mspdb120.dll. | 395 '%~dp0..\\..\\VC\\bin\\amd64;' # Needed for mspdb120.dll. |
396 '%PATH%\n') | 396 '%PATH%\n') |
397 else: | 397 else: |
398 f.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' | 398 f.write('set PATH=%~dp0..\\..\\win8sdk\\bin\\x86;' |
399 '%~dp0..\\..\\VC\\bin;%PATH%\n') | 399 '%~dp0..\\..\\VC\\bin;%PATH%\n') |
400 f.write('set LIB=%~dp0..\\..\\VC\\lib;' | 400 f.write('set LIB=%~dp0..\\..\\VC\\lib;' |
401 '%~dp0..\\..\\win8sdk\\Lib\\win8\\um\\x86;' | 401 '%~dp0..\\..\\win8sdk\\Lib\\winv6.3\\um\\x86;' |
402 '%~dp0..\\..\\VC\\atlmfc\\lib\n' | 402 '%~dp0..\\..\\VC\\atlmfc\\lib\n' |
403 'goto :EOF\n') | 403 'goto :EOF\n') |
404 | 404 |
405 # Express does not include a native 64 bit compiler, so we have to use | 405 # Express does not include a native 64 bit compiler, so we have to use |
406 # the x86->x64 cross. | 406 # the x86->x64 cross. |
407 if not pro: | 407 if not pro: |
408 # x86->x64 cross. | 408 # x86->x64 cross. |
409 f.write(':x64\n' | 409 f.write(':x64\n' |
410 'set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' | 410 'set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' |
411 '%~dp0..\\..\\VC\\bin\\x86_amd64;' | 411 '%~dp0..\\..\\VC\\bin\\x86_amd64;' |
412 # Needed for mspdb120.dll. Must be after above though, so | 412 # Needed for mspdb120.dll. Must be after above though, so |
413 # that cl.exe is the x86_amd64 one. | 413 # that cl.exe is the x86_amd64 one. |
414 '%~dp0..\\..\\VC\\bin;' | 414 '%~dp0..\\..\\VC\\bin;' |
415 '%PATH%\n') | 415 '%PATH%\n') |
416 else: | 416 else: |
417 # x64 native. | 417 # x64 native. |
418 f.write(':x64\n' | 418 f.write(':x64\n' |
419 'set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' | 419 'set PATH=%~dp0..\\..\\win8sdk\\bin\\x64;' |
420 '%~dp0..\\..\\VC\\bin\\amd64;' | 420 '%~dp0..\\..\\VC\\bin\\amd64;' |
421 '%PATH%\n') | 421 '%PATH%\n') |
422 f.write('set LIB=%~dp0..\\..\\VC\\lib\\amd64;' | 422 f.write('set LIB=%~dp0..\\..\\VC\\lib\\amd64;' |
423 '%~dp0..\\..\\win8sdk\\Lib\\win8\\um\\x64;' | 423 '%~dp0..\\..\\win8sdk\\Lib\\winv6.3\\um\\x64;' |
424 '%~dp0..\\..\\VC\\atlmfc\\lib\\amd64\n') | 424 '%~dp0..\\..\\VC\\atlmfc\\lib\\amd64\n') |
425 | 425 |
426 | 426 |
427 def DoTreeMirror(target_dir, tree_sha1): | 427 def DoTreeMirror(target_dir, tree_sha1): |
428 """In order to save temporary space on bots that do not have enough space to | 428 """In order to save temporary space on bots that do not have enough space to |
429 download ISOs, unpack them, and copy to the target location, the whole tree | 429 download ISOs, unpack them, and copy to the target location, the whole tree |
430 is uploaded as a zip to internal storage, and then mirrored here.""" | 430 is uploaded as a zip to internal storage, and then mirrored here.""" |
431 local_zip = DownloadUsingGsutil(tree_sha1 + '.zip') | 431 local_zip = DownloadUsingGsutil(tree_sha1 + '.zip') |
432 sys.stdout.write('Extracting %s...\n' % local_zip) | 432 sys.stdout.write('Extracting %s...\n' % local_zip) |
433 sys.stdout.flush() | 433 sys.stdout.flush() |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 485 } |
486 with open(os.path.join(target_dir, '..', 'data.json'), 'w') as f: | 486 with open(os.path.join(target_dir, '..', 'data.json'), 'w') as f: |
487 json.dump(data, f) | 487 json.dump(data, f) |
488 finally: | 488 finally: |
489 if options.clean: | 489 if options.clean: |
490 DeleteAllTempDirs() | 490 DeleteAllTempDirs() |
491 | 491 |
492 | 492 |
493 if __name__ == '__main__': | 493 if __name__ == '__main__': |
494 sys.exit(main()) | 494 sys.exit(main()) |
OLD | NEW |