| Index: win_toolchain/package_from_installed.py
|
| diff --git a/win_toolchain/package_from_installed.py b/win_toolchain/package_from_installed.py
|
| index e2785d722003ee44c3bc68f793fbc1bc72a441fe..500e51cc1fd8c0166d0b937416b683868c81a37f 100644
|
| --- a/win_toolchain/package_from_installed.py
|
| +++ b/win_toolchain/package_from_installed.py
|
| @@ -21,7 +21,9 @@ useful as the resulting zip can't be redistributed, and most will presumably
|
| have a Pro license anyway).
|
| """
|
|
|
| +import collections
|
| import glob
|
| +import json
|
| import optparse
|
| import os
|
| import platform
|
| @@ -214,15 +216,15 @@ def GenerateSetEnvCmd(target_dir):
|
| ['..', '..', 'VC', 'atlmfc', 'include'],
|
| ])
|
| # Common to x86 and x64
|
| - env = [
|
| + env = collections.OrderedDict([
|
| # Yuck: These two have a trailing \ character. No good way to represent this
|
| # in an OS-independent way.
|
| ('VSINSTALLDIR', [['..', '..\\']]),
|
| ('VCINSTALLDIR', [['..', '..', 'VC\\']]),
|
| ('INCLUDE', include_dirs),
|
| - ]
|
| + ])
|
| # x86. Always use amd64_x86 cross, not x86 on x86.
|
| - env_x86 = [
|
| + env_x86 = collections.OrderedDict([
|
| ('PATH', [
|
| ['..', '..', 'win_sdk', 'bin', 'x86'],
|
| ['..', '..', 'VC', 'bin', 'amd64_x86'],
|
| @@ -234,9 +236,9 @@ def GenerateSetEnvCmd(target_dir):
|
| ['..', '..', 'win_sdk', 'Lib', WIN_VERSION, 'ucrt', 'x86'], # VS 2015
|
| ['..', '..', 'VC', 'atlmfc', 'lib'],
|
| ]),
|
| - ]
|
| + ])
|
| # x64.
|
| - env_x64 = [
|
| + env_x64 = collections.OrderedDict([
|
| ('PATH', [
|
| ['..', '..', 'win_sdk', 'bin', 'x64'],
|
| ['..', '..', 'VC', 'bin', 'amd64'],
|
| @@ -247,25 +249,32 @@ def GenerateSetEnvCmd(target_dir):
|
| ['..', '..', 'win_sdk', 'Lib', WIN_VERSION, 'ucrt', 'x64'], # VS 2015
|
| ['..', '..', 'VC', 'atlmfc', 'lib', 'amd64'],
|
| ]),
|
| - ]
|
| + ])
|
| def BatDirs(dirs):
|
| return ';'.join(['%~dp0' + os.path.join(*d) for d in dirs])
|
| - with open(os.path.join(target_dir, r'win_sdk\bin\SetEnv.cmd'), 'w') as f:
|
| + set_env_prefix = os.path.join(target_dir, r'win_sdk\bin\SetEnv')
|
| + with open(set_env_prefix + '.cmd', 'w') as f:
|
| f.write('@echo off\n'
|
| ':: Generated by win_toolchain\\package_from_installed.py.\n')
|
| - for var, dirs in env:
|
| + for var, dirs in env.iteritems():
|
| f.write('set %s=%s\n' % (var, BatDirs(dirs)))
|
| f.write('if "%1"=="/x64" goto x64\n')
|
|
|
| - for var, dirs in env_x86:
|
| + for var, dirs in env_x86.iteritems():
|
| f.write('set %s=%s%s\n' % (
|
| var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else ''))
|
| f.write('goto :EOF\n')
|
|
|
| f.write(':x64\n')
|
| - for var, dirs in env_x64:
|
| + for var, dirs in env_x64.iteritems():
|
| f.write('set %s=%s%s\n' % (
|
| var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else ''))
|
| + with open(set_env_prefix + '.x86.json', 'wb') as f:
|
| + assert not set(env.keys()) & set(env_x86.keys()), 'dupe keys'
|
| + json.dump(collections.OrderedDict(env.items() + env_x86.items()), f)
|
| + with open(set_env_prefix + '.x64.json', 'wb') as f:
|
| + assert not set(env.keys()) & set(env_x64.keys()), 'dupe keys'
|
| + json.dump(collections.OrderedDict(env.items() + env_x64.items()), f)
|
|
|
|
|
| def AddEnvSetup(files):
|
|
|