OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """ | 5 """ |
6 From a system-installed copy of the toolchain, packages all the required bits | 6 From a system-installed copy of the toolchain, packages all the required bits |
7 into a .zip file. | 7 into a .zip file. |
8 | 8 |
9 It assumes default install locations for tools, in particular: | 9 It assumes default install locations for tools, in particular: |
10 - C:\Program Files (x86)\Microsoft Visual Studio 12.0\... | 10 - C:\Program Files (x86)\Microsoft Visual Studio 12.0\... |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 old_dir = os.getcwd() | 241 old_dir = os.getcwd() |
242 os.chdir(tempdir) | 242 os.chdir(tempdir) |
243 if VS_VERSION == '2013': | 243 if VS_VERSION == '2013': |
244 rel_dir = 'vs2013_files' | 244 rel_dir = 'vs2013_files' |
245 else: | 245 else: |
246 rel_dir = 'vs_files' | 246 rel_dir = 'vs_files' |
247 with zipfile.ZipFile( | 247 with zipfile.ZipFile( |
248 os.path.join(old_dir, output), 'r', zipfile.ZIP_DEFLATED, True) as zf: | 248 os.path.join(old_dir, output), 'r', zipfile.ZIP_DEFLATED, True) as zf: |
249 zf.extractall(rel_dir) | 249 zf.extractall(rel_dir) |
250 print 'Hashing...' | 250 print 'Hashing...' |
251 sha1 = get_toolchain_if_necessary.CalculateHash(rel_dir) | 251 sha1 = get_toolchain_if_necessary.CalculateHash(rel_dir, None) |
252 os.chdir(old_dir) | 252 os.chdir(old_dir) |
253 shutil.rmtree(tempdir) | 253 shutil.rmtree(tempdir) |
254 final_name = sha1 + '.zip' | 254 final_name = sha1 + '.zip' |
255 os.rename(output, final_name) | 255 os.rename(output, final_name) |
256 print 'Renamed %s to %s.' % (output, final_name) | 256 print 'Renamed %s to %s.' % (output, final_name) |
257 | 257 |
258 | 258 |
259 def main(): | 259 def main(): |
260 usage = 'usage: %prog [options] 2013|2015' | 260 usage = 'usage: %prog [options] 2013|2015' |
261 parser = optparse.OptionParser(usage) | 261 parser = optparse.OptionParser(usage) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 sys.stdout.write('\rWrote to %s.%s\n' % (output, ' '*50)) | 321 sys.stdout.write('\rWrote to %s.%s\n' % (output, ' '*50)) |
322 sys.stdout.flush() | 322 sys.stdout.flush() |
323 | 323 |
324 RenameToSha1(output) | 324 RenameToSha1(output) |
325 | 325 |
326 return 0 | 326 return 0 |
327 | 327 |
328 | 328 |
329 if __name__ == '__main__': | 329 if __name__ == '__main__': |
330 sys.exit(main()) | 330 sys.exit(main()) |
OLD | NEW |