Chromium Code Reviews| Index: build/vs_toolchain.py |
| diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py |
| index bdedd6fa8822f121da2687d338cbdf3f58140575..08dfbff4b874e84abcb504d64451f2a0ecca6643 100644 |
| --- a/build/vs_toolchain.py |
| +++ b/build/vs_toolchain.py |
| @@ -5,6 +5,7 @@ |
| import json |
| import os |
| import pipes |
| +import shlex |
| import shutil |
| import subprocess |
| import sys |
| @@ -18,7 +19,34 @@ sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) |
| json_data_file = os.path.join(script_dir, 'win_toolchain.json') |
| -import gyp |
| +def NameValueListToDict(name_value_list): |
|
scottmg
2014/11/03 22:28:34
This was also to avoid pulling gyp. Maybe I should
|
| + """ |
| + Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary |
| + of the pairs. If a string is simply NAME, then the value in the dictionary |
| + is set to True. If VALUE can be converted to an integer, it is. |
| + """ |
| + result = { } |
| + for item in name_value_list: |
| + tokens = item.split('=', 1) |
| + if len(tokens) == 2: |
| + # If we can make it an int, use that, otherwise, use the string. |
| + try: |
| + token_value = int(tokens[1]) |
| + except ValueError: |
| + token_value = tokens[1] |
| + # Set the variable to the supplied value. |
| + result[tokens[0]] = token_value |
| + else: |
| + # No value supplied, treat it as a boolean and set it. |
| + result[tokens[0]] = True |
| + return result |
| + |
| + |
| +def ShlexEnv(env_name): |
| + flags = os.environ.get(env_name, []) |
| + if flags: |
| + flags = shlex.split(flags) |
| + return flags |
| def SetEnvironmentAndGetRuntimeDllDirs(): |
| @@ -51,7 +79,7 @@ def SetEnvironmentAndGetRuntimeDllDirs(): |
| # toolchain values in GYP_DEFINES, but don't want to override any |
| # otheroptions.express |
| # values there. |
| - gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES')) |
| + gyp_defines_dict = NameValueListToDict(ShlexEnv('GYP_DEFINES')) |
| gyp_defines_dict['windows_sdk_path'] = win8sdk |
| os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v))) |
| for k, v in gyp_defines_dict.iteritems()) |