summaryrefslogtreecommitdiff
path: root/piglit-summary-html.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-10-12 12:06:00 +0200
committerPaul Berry <stereotype441@gmail.com>2011-10-13 09:46:24 -0700
commit88ecb306d3582091585f07e4c2087b4b6b51e461 (patch)
tree545ecea7f562d0710269d34bb784b09a7cfefba5 /piglit-summary-html.py
parent022cc63ccea37f8426c86f61b164289a79fa10db (diff)
Make Python scripts independent of the current working directory
The main purpose of this patch is to make piglit independent of the current working directory, so it is possible to package piglit as a RPM package (with binaries symlinked to /usr/bin, most of the files in read-only /usr/lib*/piglit directory, and results somewhere else). So it is now possible to run $ piglit-run tests/quick-driver.tests /tmp/piglit and then with this command $ piglit-summary-html --overwrite /tmp/piglit/results /tmp/piglit/main generate a report in /tmp/piglit/results/index.html & al. Signed-off-by: Matěj Cepl <mcepl@redhat.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'piglit-summary-html.py')
-rwxr-xr-xpiglit-summary-html.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index a255a153a..56e4449b0 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -23,9 +23,10 @@
from getopt import getopt, GetoptError
import cgi
-import os
+import os, os.path
import sys
+sys.path.append(os.path.dirname(os.path.realpath(sys.argv[0])))
import framework.core as core
import framework.summary
@@ -53,7 +54,7 @@ def writefile(filename, text):
f.write(text.encode('utf-8'))
f.close()
-templatedir = os.path.join(os.path.dirname(__file__), 'templates')
+templatedir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'templates')
Result = readfile(os.path.join(templatedir, 'result.html'))
ResultDetail = readfile(os.path.join(templatedir, 'result_detail.html'))
ResultList = readfile(os.path.join(templatedir, 'result_list.html'))