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

Unified Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 168603004: Move toolchain update control into src, but keep download logic in depot_tools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: reitveld Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « update_depot_tools.bat ('k') | win_toolchain/toolchain2013.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win_toolchain/get_toolchain_if_necessary.py
diff --git a/win_toolchain/get_toolchain_if_necessary.py b/win_toolchain/get_toolchain_if_necessary.py
index 3ac6689c695f654f9cc2e151db969b86287c7b2c..4af2e7f7a3c5badd77f0829b436d03a24ed7bd13 100755
--- a/win_toolchain/get_toolchain_if_necessary.py
+++ b/win_toolchain/get_toolchain_if_necessary.py
@@ -29,7 +29,9 @@ maintained, and a new 2015 script would be added.
import ctypes.wintypes
import hashlib
import json
+import optparse
import os
+import shutil
import subprocess
import sys
import time
@@ -145,9 +147,12 @@ def main():
if not sys.platform.startswith(('cygwin', 'win32')):
return 0
- if len(sys.argv) != 1:
- print >> sys.stderr, 'Unexpected arguments.'
- return 1
+ parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
+ parser.add_option('--output-json', metavar='FILE',
+ help='write information about toolchain to FILE')
+ options, args = parser.parse_args()
+
+ desired_hashes = set(args)
# Move to depot_tools\win_toolchain where we'll store our files, and where
# the downloader script is.
@@ -155,12 +160,6 @@ def main():
toolchain_dir = '.'
target_dir = os.path.normpath(os.path.join(toolchain_dir, 'vs2013_files'))
- sha1path = os.path.join(toolchain_dir, 'toolchain_vs2013.hash')
- desired_hashes = set()
- if os.path.isfile(sha1path):
- with open(sha1path, 'rb') as f:
- desired_hashes = set(f.read().strip().splitlines())
-
# If the current hash doesn't match what we want in the file, nuke and pave.
# Typically this script is only run when the .sha1 one file is updated, but
# directly calling "gclient runhooks" will also run it, so we cache
@@ -195,6 +194,9 @@ def main():
return 1
SaveTimestampsAndHash(target_dir, current_hash)
+ if options.output_json:
+ shutil.copyfile(os.path.join(target_dir, 'data.json'), options.output_json)
+
return 0
« no previous file with comments | « update_depot_tools.bat ('k') | win_toolchain/toolchain2013.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698