Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 1680433002: Skip installation of UCRT (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 # Windows 8.1, Windows Server 2012 R2, and Windows 10. 347 # Windows 8.1, Windows Server 2012 R2, and Windows 10.
348 # The Windows 8.1 installer doesn't work on Windows 10, but it will never 348 # The Windows 8.1 installer doesn't work on Windows 10, but it will never
349 # be used because the UCRT is always installed on Windows 10. 349 # be used because the UCRT is always installed on Windows 10.
350 return 'Windows8.1-KB2999226-x64.msu' 350 return 'Windows8.1-KB2999226-x64.msu'
351 else: 351 else:
352 # Some future OS. 352 # Some future OS.
353 return None 353 return None
354 354
355 355
356 def InstallUniversalCRTIfNeeded(abs_target_dir): 356 def InstallUniversalCRTIfNeeded(abs_target_dir):
357 installer_name = GetInstallerName() 357 return
358 if not installer_name:
359 return
360
361 bitness = platform.architecture()[0]
362 # When running 64-bit python the x64 DLLs will be in System32
363 x64_path = 'System32' if bitness == '64bit' else 'Sysnative'
364 x64_path = os.path.join(r'C:\Windows', x64_path)
365 sample_crt_file = os.path.join(x64_path, 'ucrtbase.dll')
366
367 if os.path.exists(sample_crt_file):
368 # Nothing to do.
369 return
370
371 print ('%s does not exist - installing Windows 10 Universal C Runtime' %
372 sample_crt_file)
373
374 installer = os.path.join(abs_target_dir, "installers", installer_name)
375 command = r'wusa.exe /quiet "%s"' % installer
376 print 'Running %s' % command
377
378 try:
379 subprocess.check_call(command)
380 # Trap OSError instead of WindowsError so pylint will succeed on Linux.
381 except OSError as e:
382 if e.winerror == 740: # The requested operation requires elevation
383 print 'Elevation required. You can manually install this update:'
384 print ' %s' % installer
385 return
386 raise e
387 358
388 359
389 def main(): 360 def main():
390 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) 361 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
391 parser.add_option('--output-json', metavar='FILE', 362 parser.add_option('--output-json', metavar='FILE',
392 help='write information about toolchain to FILE') 363 help='write information about toolchain to FILE')
393 parser.add_option('--force', action='store_true', 364 parser.add_option('--force', action='store_true',
394 help='force script to run on non-Windows hosts') 365 help='force script to run on non-Windows hosts')
395 options, args = parser.parse_args() 366 options, args = parser.parse_args()
396 367
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 if os.environ.get('GYP_MSVS_VERSION') == '2015': 474 if os.environ.get('GYP_MSVS_VERSION') == '2015':
504 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) 475 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir)
505 476
506 RemoveUnusedToolchains(target_dir) 477 RemoveUnusedToolchains(target_dir)
507 478
508 return 0 479 return 0
509 480
510 481
511 if __name__ == '__main__': 482 if __name__ == '__main__':
512 sys.exit(main()) 483 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698