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

Unified Diff: build/vs_toolchain.py

Issue 1277913006: Let build/vs_toolchain.py run on non-Windows if requested. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/vs_toolchain.py
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py
old mode 100644
new mode 100755
index 25131659f795588f3156c48b0150890aad2f9c48..cea0d6d0e32f518f73388f000b1e1cf6c6c4b233
--- a/build/vs_toolchain.py
+++ b/build/vs_toolchain.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -29,7 +30,10 @@ def SetEnvironmentAndGetRuntimeDllDirs():
vs2013_runtime_dll_dirs = None
depot_tools_win_toolchain = \
bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
- if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain:
+ # When running on a non-Windows host, only do this if the SDK has explicitly
+ # been downloaded before (in which case json_data_file will exist).
+ if ((sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain) or
+ os.path.exists(json_data_file)):
if not os.path.exists(json_data_file):
Update()
with open(json_data_file, 'r') as tempf:
@@ -116,8 +120,6 @@ def CopyVsRuntimeDlls(output_dir, runtime_dirs):
This needs to be run after gyp has been run so that the expected target
output directories are already created.
"""
- assert sys.platform.startswith(('win32', 'cygwin'))
-
x86, x64 = runtime_dirs
out_debug = os.path.join(output_dir, 'Debug')
out_debug_nacl64 = os.path.join(output_dir, 'Debug', 'x64')
@@ -193,14 +195,21 @@ def _GetDesiredVsToolchainHashes():
return ['ee7d718ec60c2dc5d255bbe325909c2021a7efef']
-def Update():
+def Update(force=False):
"""Requests an update of the toolchain to the specific hashes we have at
this revision. The update outputs a .json of the various configuration
information required to pass to gyp which we use in |GetToolchainDir()|.
"""
+ if force != False and force != '--force':
+ print >>sys.stderr, 'Unknown parameter "%s"' % force
+ return 1
+ if force == '--force' or os.path.exists(json_data_file):
+ force = True
+
depot_tools_win_toolchain = \
bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
- if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain:
+ if ((sys.platform in ('win32', 'cygwin') or force) and
+ depot_tools_win_toolchain):
import find_depot_tools
depot_tools_path = find_depot_tools.add_depot_tools_to_path()
get_toolchain_args = [
@@ -210,6 +219,8 @@ def Update():
'get_toolchain_if_necessary.py'),
'--output-json', json_data_file,
] + _GetDesiredVsToolchainHashes()
+ if force:
+ get_toolchain_args.append('--force')
subprocess.check_call(get_toolchain_args)
return 0
@@ -240,8 +251,6 @@ runtime_dirs = "%s"
def main():
- if not sys.platform.startswith(('win32', 'cygwin')):
- return 0
commands = {
'update': Update,
'get_toolchain_dir': GetToolchainDir,
« 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