mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Move toolchain update control into src, but keep download logic in depot_tools
Moves the update functionality out of update_depot_tools into src/ in https://codereview.chromium.org/175573004 . get_toolchain_if_required.py now expects a list of hashes on the command line, and makes sure that it gets one of those. toolchain2013.py saves a .json which contains information relevant to the interests of the caller, so that it can set up the parent environment. This is returned via the --output-json command line argument to get_...py R=iannucci@chromium.org BUG=323300 Review URL: https://codereview.chromium.org/168603004 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@252725 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -30,13 +30,6 @@ if errorlevel 1 goto :EOF
|
||||
:: Now clear errorlevel so it can be set by other programs later.
|
||||
set errorlevel=
|
||||
|
||||
:: Opt-in for now.
|
||||
IF "%DEPOT_TOOLS_WIN_TOOLCHAIN%" == "" GOTO :NOTOOLCHAIN
|
||||
call python %~dp0win_toolchain\get_toolchain_if_necessary.py
|
||||
if errorlevel 1 goto :EOF
|
||||
set errorlevel=
|
||||
:NOTOOLCHAIN
|
||||
|
||||
:: Shall skip automatic update?
|
||||
IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF
|
||||
|
||||
@@ -74,4 +67,4 @@ goto :EOF
|
||||
:GIT_SVN_UPDATE
|
||||
cd /d "%DEPOT_TOOLS_DIR%."
|
||||
call git svn rebase -q -q
|
||||
goto :EOF
|
||||
goto :EOF
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
import ctypes
|
||||
import json
|
||||
import optparse
|
||||
import os
|
||||
import shutil
|
||||
@@ -456,8 +457,18 @@ def main():
|
||||
CopyToFinalLocation(extracted, target_dir)
|
||||
|
||||
GenerateSetEnvCmd(target_dir, not options.express)
|
||||
with open(os.path.join(target_dir, '.version'), 'w') as f:
|
||||
f.write('express' if options.express else 'pro')
|
||||
data = {
|
||||
'path': target_dir,
|
||||
'version': '2013e' if options.express else '2013',
|
||||
'win8sdk': os.path.join(target_dir, 'win8sdk'),
|
||||
'wdk': os.path.join(target_dir, 'wdk'),
|
||||
'runtime_dirs': [
|
||||
os.path.join(target_dir, 'sys64'),
|
||||
os.path.join(target_dir, 'sys32'),
|
||||
],
|
||||
}
|
||||
with open(os.path.join(target_dir, 'data.json'), 'w') as f:
|
||||
json.dump(data, f)
|
||||
finally:
|
||||
if options.clean:
|
||||
DeleteAllTempDirs()
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
0bbca7f56298c3075b183cd9d11b3529c88ce775
|
||||
9d48ee27f0d29e02fd89dd5d1d6208bf42fd6e16
|
||||
Reference in New Issue
Block a user