[Piglit] [PATCH] framework: Add python version to mako template dirs

Dylan Baker baker.dylan.c at gmail.com
Fri Mar 6 11:00:22 PST 2015


Since these templates are at the very least not compatible betwen 3.x
and 2.x, and possibly not backwards compatible from 3.x to 3.x-1 it
makes better sense to actually maintain the version.

This allows easy transition between python versions without blowing away
the mako cache on every iteration.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/summary.py                  | 2 ++
 generated_tests/templates/__init__.py | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/framework/summary.py b/framework/summary.py
index 619d4f5..9beb537 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -29,6 +29,7 @@ import tempfile
 import datetime
 import re
 import getpass
+import sys
 
 from mako.template import Template
 
@@ -279,6 +280,7 @@ class Summary:
     """
     TEMP_DIR = path.join(tempfile.gettempdir(),
                          "piglit-{}".format(getpass.getuser()),
+                         'version-{}'.format(sys.version.split()[0]),
                          "html-summary")
     TEMPLATE_DIR = path.abspath(
         path.join(path.dirname(__file__), '..', 'templates'))
diff --git a/generated_tests/templates/__init__.py b/generated_tests/templates/__init__.py
index b796eff..f974825 100644
--- a/generated_tests/templates/__init__.py
+++ b/generated_tests/templates/__init__.py
@@ -22,6 +22,7 @@
 
 from __future__ import absolute_import
 import os
+import sys
 import getpass
 import tempfile
 
@@ -32,6 +33,7 @@ from mako.lookup import TemplateLookup
 # Based on a similar setup in framework/summary
 MAKO_TEMP_DIR = os.path.join(tempfile.gettempdir(),
                              'piglit-{0}'.format(getpass.getuser()),
+                             'version-{0}'.format(sys.version.split()[0]),
                              'generators', 'templates')
 
 TEMPLATE_DIR = os.path.abspath(os.path.dirname(__file__))
-- 
2.3.1



More information about the Piglit mailing list