Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Unified Diff: gm/gm_json.py

Issue 117783004: rebaseline_server: write JSON files using Unix line endings, even on Windows (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gm_json.py
diff --git a/gm/gm_json.py b/gm/gm_json.py
index 1d8da9f12799af8621bb72c1642e94b4695faa01..2c37d6a35c51c40329e2a56b249661da62b10442 100644
--- a/gm/gm_json.py
+++ b/gm/gm_json.py
@@ -12,6 +12,7 @@ __author__ = 'Elliot Poger'
# system-level imports
+import io
import json
import os
@@ -124,6 +125,10 @@ def LoadFromFile(file_path):
return LoadFromString(file_contents)
def WriteToFile(json_dict, file_path):
- """Writes the JSON summary in json_dict out to file_path."""
- with open(file_path, 'w') as outfile:
- json.dump(json_dict, outfile, sort_keys=True, indent=2)
+ """Writes the JSON summary in json_dict out to file_path.
+
+ The file is written Unix-style (each line ends with just LF, not CRLF);
+ see https://code.google.com/p/skia/issues/detail?id=1815 for reasons."""
+ with io.open(file_path, mode='w', newline='', encoding='utf-8') as outfile:
+ outfile.write(unicode(json.dumps(json_dict, outfile, sort_keys=True,
+ indent=2)))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698