Make setup_toolchain.py run on non-Windows.

Also delete an unused, commented-out block of code.

BUG=495204

Review URL: https://codereview.chromium.org/1822633002

Cr-Original-Commit-Position: refs/heads/master@{#382330}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0917363388c80cb57ee5ceba36dcd047b4bf1d19
This commit is contained in:
thakis 2016-03-21 11:20:30 -07:00 коммит произвёл Commit bot
Родитель e766152188
Коммит 7b4c8c9bef
1 изменённых файлов: 10 добавлений и 20 удалений

Просмотреть файл

@ -50,6 +50,7 @@ def _ExtractImportantEnvironment(output_of_set):
setting = os.path.dirname(sys.executable) + os.pathsep + setting setting = os.path.dirname(sys.executable) + os.pathsep + setting
env[var.upper()] = setting env[var.upper()] = setting
break break
if sys.platform in ('win32', 'cygwin'):
for required in ('SYSTEMROOT', 'TEMP', 'TMP'): for required in ('SYSTEMROOT', 'TEMP', 'TMP'):
if required not in env: if required not in env:
raise Exception('Environment variable "%s" ' raise Exception('Environment variable "%s" '
@ -108,6 +109,7 @@ def _LoadToolchainEnv(cpu, sdk_dir):
variables = '\n'.join(varlines) variables = '\n'.join(varlines)
# Check that the json file contained the same environment as the .cmd file. # Check that the json file contained the same environment as the .cmd file.
if sys.platform in ('win32', 'cygwin'):
script = os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.cmd')) script = os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.cmd'))
assert _ExtractImportantEnvironment(variables) == \ assert _ExtractImportantEnvironment(variables) == \
_ExtractImportantEnvironment(_LoadEnvFromBat([script, '/' + cpu])) _ExtractImportantEnvironment(_LoadEnvFromBat([script, '/' + cpu]))
@ -171,7 +173,7 @@ def main():
for cpu in cpus: for cpu in cpus:
# Extract environment variables for subprocesses. # Extract environment variables for subprocesses.
env = _LoadToolchainEnv(cpu, win_sdk_path) env = _LoadToolchainEnv(cpu, win_sdk_path)
env['PATH'] = runtime_dirs + os.path.pathsep + env['PATH'] env['PATH'] = runtime_dirs + os.pathsep + env['PATH']
if cpu == target_cpu: if cpu == target_cpu:
for path in env['PATH'].split(os.pathsep): for path in env['PATH'].split(os.pathsep):
@ -179,18 +181,6 @@ def main():
vc_bin_dir = os.path.realpath(path) vc_bin_dir = os.path.realpath(path)
break break
# Add extra include directories here that need to be in front of the
# installed and packaged include directories. This may be needed in
# order to force a particular SDK version, such as to get VS 2013 to use
# the Windows 10 SDK. Beware of making the INCLUDE variable excessively
# long and be sure to make corresponding changes to build\common.gypi.
# Not currently used.
#if win_sdk_path:
# additional_includes = [
# os.path.join(win_sdk_path, 'Include', '10.0.10586.0', p)
# for p in ['shared', 'um', 'winrt']]
# additional_includes = os.path.pathsep.join(additional_includes)
# env['INCLUDE'] = additional_includes + os.path.pathsep + env['INCLUDE']
env_block = _FormatAsEnvironmentBlock(env) env_block = _FormatAsEnvironmentBlock(env)
with open('environment.' + cpu, 'wb') as f: with open('environment.' + cpu, 'wb') as f:
f.write(env_block) f.write(env_block)