Index: core/scripts/template_expander.py |
diff --git a/core/scripts/template_expander.py b/core/scripts/template_expander.py |
index aafeb6840e66dc861d05b7cd3c7901c2884296ff..b1e99b671fddd8e9a82dcd9cd3118c5ed9811164 100644 |
--- a/core/scripts/template_expander.py |
+++ b/core/scripts/template_expander.py |
@@ -31,14 +31,15 @@ import sys |
_current_dir = os.path.dirname(os.path.realpath(__file__)) |
# jinja2 is in chromium's third_party directory |
-sys.path.append(os.path.join(_current_dir, *([os.pardir] * 4))) |
+# Insert at front to override system libraries, and after path[0] == script dir |
+sys.path.insert(1, os.path.join(_current_dir, *([os.pardir] * 4))) |
import jinja2 |
def apply_template(path_to_template, params): |
dirname, basename = os.path.split(path_to_template) |
path_to_templates = os.path.join(_current_dir, "templates") |
- jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader([dirname, path_to_templates])) |
+ jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader([dirname, path_to_templates]), keep_trailing_newline=True) |
template = jinja_env.get_template(basename) |
return template.render(params) |