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

Side by Side Diff: win_toolchain/toolchain2013.py

Issue 828463003: Fix gsutil execution on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « gsutil.py ('k') | 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 """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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 def ExtractIso(iso_path): 143 def ExtractIso(iso_path):
144 """Uses 7zip to extract the contents of the given .iso (or self-extracting 144 """Uses 7zip to extract the contents of the given .iso (or self-extracting
145 .exe). 145 .exe).
146 """ 146 """
147 target_path = TempDir() 147 target_path = TempDir()
148 sys.stdout.write('Extracting %s...\n' % iso_path) 148 sys.stdout.write('Extracting %s...\n' % iso_path)
149 sys.stdout.flush() 149 sys.stdout.flush()
150 # TODO(scottmg): Do this (and exe) manually with python code. 150 # TODO(scottmg): Do this (and exe) manually with python code.
151 # Note that at the beginning of main() we set the working directory to 7z's 151 # Note that at the beginning of main() we set the working directory to 7z's
152 # location so that 7z can find its codec dll. 152 # location so that 7z can find its codec dll.
153 RunOrDie('7z x "%s" -y "-o%s" >nul' % (iso_path, target_path)) 153 RunOrDie('7z x "%s" -y "-o%s"' % (iso_path, target_path))
154 return target_path 154 return target_path
155 155
156 156
157 def ExtractMsi(msi_path): 157 def ExtractMsi(msi_path):
158 """Uses msiexec to extract the contents of the given .msi file.""" 158 """Uses msiexec to extract the contents of the given .msi file."""
159 sys.stdout.write('Extracting %s...\n' % msi_path) 159 sys.stdout.write('Extracting %s...\n' % msi_path)
160 with ScopedSubstTempDir() as temp_dir: 160 with ScopedSubstTempDir() as temp_dir:
161 RunOrDie('msiexec /a "%s" /qn TARGETDIR="%s"' % ( 161 RunOrDie('msiexec /a "%s" /qn TARGETDIR="%s"' % (
162 msi_path, temp_dir.ShortenedPath())) 162 msi_path, temp_dir.ShortenedPath()))
163 return temp_dir.RealPath() 163 return temp_dir.RealPath()
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()
434 RunOrDie('7z x "%s" -y "-o%s" >nul' % (local_zip, target_dir)) 434 RunOrDie('7z x "%s" -y "-o%s"' % (local_zip, target_dir))
435 435
436 436
437 def main(): 437 def main():
438 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) 438 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
439 parser.add_option('--targetdir', metavar='DIR', 439 parser.add_option('--targetdir', metavar='DIR',
440 help='put toolchain into DIR', 440 help='put toolchain into DIR',
441 default=os.path.join(BASEDIR, 'win_toolchain_2013')) 441 default=os.path.join(BASEDIR, 'win_toolchain_2013'))
442 parser.add_option('--noclean', action='store_false', dest='clean', 442 parser.add_option('--noclean', action='store_false', dest='clean',
443 help='do not remove temp files', 443 help='do not remove temp files',
444 default=True) 444 default=True)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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())
OLDNEW
« no previous file with comments | « gsutil.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698