summaryrefslogtreecommitdiff
path: root/generated_tests
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-04-13 11:27:32 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-05-05 15:15:07 -0700
commit11e4950c91505368ff90eb561eb5a3eec5d2502a (patch)
tree37206f6b1387c9d1e6b2222f58227ce76341e9b0 /generated_tests
parentfe703e518510f24cc1da78eab249a152b9f66701 (diff)
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 <dylanx.c.baker@intel.com>
Diffstat (limited to 'generated_tests')
-rw-r--r--generated_tests/templates/__init__.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/generated_tests/templates/__init__.py b/generated_tests/templates/__init__.py
index f974825b4..c7f32c225 100644
--- a/generated_tests/templates/__init__.py
+++ b/generated_tests/templates/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2014 Intel Corporation
+# Copyright (c) 2014-2016 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -26,15 +26,18 @@ import sys
import getpass
import tempfile
+import mako
from mako.template import Template
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')
+ getpass.getuser(),
+ 'piglit',
+ 'python-{}'.format(sys.version.split()[0]),
+ 'mako-{}'.format(mako.__version__),
+ 'generators')
TEMPLATE_DIR = os.path.abspath(os.path.dirname(__file__))