Commit 7aa68240 authored by John Emau's avatar John Emau Committed by LUCI CQ

gclient: setdep writes binary for windows newline support

This fixes an issue on Windows where running `gclient setdep` would convert the DEPS file from LF to CRLF line endings.

From the python 2.7 docs:

" On Windows, 'b' appended to the mode opens the file in binary mode, so there are also modes like 'rb', 'wb', and 'r+b'. Python on Windows makes a distinction between text and binary files; the end-of-line characters in text files are automatically altered slightly when data is read or written. "

- https://docs.python.org/2.7/tutorial/inputoutput.html#reading-and-writing-files

Change-Id: I94183918789a8cdd4aa655db4b3dadfaae23d13a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2067477Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: John Emau <John.Emau@microsoft.com>
parent d55c5077
......@@ -2981,8 +2981,8 @@ def CMDsetdep(parser, args):
else:
gclient_eval.SetRevision(local_scope, name, value)
with open(options.deps_file, 'w') as f:
f.write(gclient_eval.RenderDEPSFile(local_scope))
with open(options.deps_file, 'wb') as f:
f.write(gclient_eval.RenderDEPSFile(local_scope).encode('utf-8'))
@metrics.collector.collect_metrics('gclient verify')
......
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