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

Unified Diff: build/android/gyp/jinja_template.py

Issue 816813003: Make android jinja wrapper work on utf-8 templates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use codecs.open instead of str.decode/encode Created 5 years, 11 months 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: build/android/gyp/jinja_template.py
diff --git a/build/android/gyp/jinja_template.py b/build/android/gyp/jinja_template.py
index 8e579aa6a3df3eebb7f5e0bed2cf2859f2906a06..3a93f746fe14891caef4d3aaf6a3377ab2b4fc9e 100755
--- a/build/android/gyp/jinja_template.py
+++ b/build/android/gyp/jinja_template.py
@@ -6,6 +6,7 @@
"""Renders one or more template files using the Jinja template engine."""
+import codecs
import optparse
import os
import sys
@@ -18,13 +19,13 @@ import jinja2 # pylint: disable=F0401
def ProcessFile(input_filename, output_filename, variables):
- with open(input_filename, 'r') as input_file:
+ with codecs.open(input_filename, 'r', 'utf-8') as input_file:
input_ = input_file.read()
env = jinja2.Environment(undefined=jinja2.StrictUndefined)
template = env.from_string(input_)
template.filename = os.path.abspath(input_filename)
output = template.render(variables)
- with open(output_filename, 'w') as output_file:
+ with codecs.open(output_filename, 'w', 'utf-8') as output_file:
output_file.write(output)
« 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