Commit bfcde3c5 authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

gclient_eval: Make compatible with Python 3.

A new-line token is being added on Python 3, so add it explicitly
so that it also appears on Python 2.

Bug: 984182
Change-Id: I3bfb6ca83d94b6a3452b938f35f5a3174fe85903
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1764465Reviewed-by: 's avatarMarc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent 255b36d8
......@@ -688,7 +688,7 @@ def AddVar(gclient_dict, var_name, value):
col = node.keys[0].col_offset
# We use a minimal Python dictionary, so that ast can parse it.
var_content = '{\n%s"%s": "%s",\n}' % (' ' * col, var_name, value)
var_content = '{\n%s"%s": "%s",\n}\n' % (' ' * col, var_name, value)
var_ast = ast.parse(var_content).body[0].value
# Set the ast nodes for the key and value.
......@@ -707,7 +707,7 @@ def AddVar(gclient_dict, var_name, value):
var_tokens = {
token[2]: list(token)
# Ignore the tokens corresponding to braces and new lines.
for token in var_tokens[2:-2]
for token in var_tokens[2:-3]
}
gclient_dict.tokens = _ShiftLinesInTokens(gclient_dict.tokens, 1, line)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment