From 11e4950c91505368ff90eb561eb5a3eec5d2502a Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 13 Apr 2016 11:27:32 -0700 Subject: python: Make mako template dirs robust This puts the templates in a directory structure that makes them robust to both changes in python version and mako version. This fixes errors caused by downgrading mako, which isn't that common, unless you're running the unit tests with use the oldest supported mako, and may conflict with the compiled templates from the system mako. Signed-off-by: Dylan Baker --- framework/summary/html_.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'framework/summary') diff --git a/framework/summary/html_.py b/framework/summary/html_.py index 676fa1a8a..80bee82e0 100644 --- a/framework/summary/html_.py +++ b/framework/summary/html_.py @@ -25,13 +25,14 @@ from __future__ import ( absolute_import, division, print_function, unicode_literals ) +import errno +import getpass import os import shutil -import tempfile -import getpass import sys -import errno +import tempfile +import mako from mako.lookup import TemplateLookup import six @@ -49,8 +50,11 @@ __all__ = [ _TEMP_DIR = os.path.join( tempfile.gettempdir(), - "piglit-{}".format(getpass.getuser()), - 'version-{}'.format(sys.version.split()[0])) + getpass.getuser(), + 'python-{}'.format(sys.version.split()[0]), + 'mako-{}'.format(mako.__version__), + 'summary', + 'html') _TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), '../..', 'templates') -- cgit v1.2.3