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

Side by Side Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 1660723002: Updates to package VS 2015 to not require UCRT (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Add blank line per code review 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 | win_toolchain/package_from_installed.py » ('j') | 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 matches = len(file_list) == len(timestamps_data['files']) 105 matches = len(file_list) == len(timestamps_data['files'])
106 if matches: 106 if matches:
107 for disk, cached in zip(file_list, timestamps_data['files']): 107 for disk, cached in zip(file_list, timestamps_data['files']):
108 if disk != cached[0] or os.stat(disk).st_mtime != cached[1]: 108 if disk != cached[0] or os.stat(disk).st_mtime != cached[1]:
109 matches = False 109 matches = False
110 break 110 break
111 if matches: 111 if matches:
112 return timestamps_data['sha1'] 112 return timestamps_data['sha1']
113 113
114 # Make long hangs when updating the toolchain less mysterious.
115 print 'Calculating hash of toolchain in %s. Please wait...' % root
116 sys.stdout.flush()
114 digest = hashlib.sha1() 117 digest = hashlib.sha1()
115 for path in file_list: 118 for path in file_list:
116 digest.update(str(path).replace('/', '\\')) 119 digest.update(str(path).replace('/', '\\'))
117 with open(path, 'rb') as f: 120 with open(path, 'rb') as f:
118 digest.update(f.read()) 121 digest.update(f.read())
119 return digest.hexdigest() 122 return digest.hexdigest()
120 123
121 124
122 def SaveTimestampsAndHash(root, sha1): 125 def SaveTimestampsAndHash(root, sha1):
123 """Saves timestamps and the final hash to be able to early-out more quickly 126 """Saves timestamps and the final hash to be able to early-out more quickly
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 289
287 installer = os.path.join(abs_target_dir, "installers", installer_name) 290 installer = os.path.join(abs_target_dir, "installers", installer_name)
288 command = r'wusa.exe /quiet "%s"' % installer 291 command = r'wusa.exe /quiet "%s"' % installer
289 print 'Running %s' % command 292 print 'Running %s' % command
290 293
291 try: 294 try:
292 subprocess.check_call(command) 295 subprocess.check_call(command)
293 # Trap OSError instead of WindowsError so pylint will succeed on Linux. 296 # Trap OSError instead of WindowsError so pylint will succeed on Linux.
294 except OSError as e: 297 except OSError as e:
295 if e.winerror == 740: # The requested operation requires elevation 298 if e.winerror == 740: # The requested operation requires elevation
296 print 299 print 'Elevation required. You can manually install this update:'
297 print '-'*80
298 print
299 print 'Elevation required. You must manually install this update:'
300 print ' %s' % installer 300 print ' %s' % installer
301 print 301 return
302 print '-'*80
303 print
304 raise Exception('Elevation required. You must manually install %s' %
305 installer)
306 raise e 302 raise e
307 303
308 304
309 def main(): 305 def main():
310 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) 306 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
311 parser.add_option('--output-json', metavar='FILE', 307 parser.add_option('--output-json', metavar='FILE',
312 help='write information about toolchain to FILE') 308 help='write information about toolchain to FILE')
313 parser.add_option('--force', action='store_true', 309 parser.add_option('--force', action='store_true',
314 help='force script to run on non-Windows hosts') 310 help='force script to run on non-Windows hosts')
315 options, args = parser.parse_args() 311 options, args = parser.parse_args()
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 options.output_json) 422 options.output_json)
427 423
428 if os.environ.get('GYP_MSVS_VERSION') == '2015': 424 if os.environ.get('GYP_MSVS_VERSION') == '2015':
429 InstallUniversalCRTIfNeeded(abs_target_dir) 425 InstallUniversalCRTIfNeeded(abs_target_dir)
430 426
431 return 0 427 return 0
432 428
433 429
434 if __name__ == '__main__': 430 if __name__ == '__main__':
435 sys.exit(main()) 431 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | win_toolchain/package_from_installed.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698