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

Side by Side Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 1689723002: Make get_toolchain_if_necessary.py work on Mac again (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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return timestamps_data['sha1'] 123 return timestamps_data['sha1']
124 124
125 # Make long hangs when updating the toolchain less mysterious. 125 # Make long hangs when updating the toolchain less mysterious.
126 print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path 126 print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path
127 sys.stdout.flush() 127 sys.stdout.flush()
128 digest = hashlib.sha1() 128 digest = hashlib.sha1()
129 for path in file_list: 129 for path in file_list:
130 path_without_hash = str(path).replace('/', '\\') 130 path_without_hash = str(path).replace('/', '\\')
131 if expected_hash: 131 if expected_hash:
132 path_without_hash = path_without_hash.replace( 132 path_without_hash = path_without_hash.replace(
133 os.path.join(root, expected_hash), root) 133 os.path.join(root, expected_hash).replace('/', '\\'), root)
134 digest.update(path_without_hash) 134 digest.update(path_without_hash)
135 with open(path, 'rb') as f: 135 with open(path, 'rb') as f:
136 digest.update(f.read()) 136 digest.update(f.read())
137 return digest.hexdigest() 137 return digest.hexdigest()
138 138
139 139
140 def CalculateToolchainHashes(root): 140 def CalculateToolchainHashes(root):
141 """Calculate the hash of the different toolchains installed in the |root| 141 """Calculate the hash of the different toolchains installed in the |root|
142 directory.""" 142 directory."""
143 hashes = [] 143 hashes = []
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 if os.environ.get('GYP_MSVS_VERSION') == '2015': 474 if os.environ.get('GYP_MSVS_VERSION') == '2015':
475 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir) 475 InstallUniversalCRTIfNeeded(abs_toolchain_target_dir)
476 476
477 RemoveUnusedToolchains(target_dir) 477 RemoveUnusedToolchains(target_dir)
478 478
479 return 0 479 return 0
480 480
481 481
482 if __name__ == '__main__': 482 if __name__ == '__main__':
483 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