[Piglit] [PATCH 1/2] framework/summary.py: Set constants for directories

Damien Lespiau damien.lespiau at intel.com
Wed Nov 13 11:46:31 PST 2013


On Wed, Nov 13, 2013 at 11:12:24AM -0800, Dylan Baker wrote:
> This uses python's tempfile module to get a platform dependent place to
> put temporary files, which should allow html summary to work even when
> installed somewhere read-only.
> 
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>  framework/summary.py | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/framework/summary.py b/framework/summary.py
> index a587712..bbb423f 100644
> --- a/framework/summary.py
> +++ b/framework/summary.py
> @@ -24,6 +24,7 @@ import os.path as path
>  import itertools
>  import shutil
>  import collections
> +import tempfile
>  from mako.template import Template
>  
>  # a local variable status exists, prevent accidental overloading by renaming
> @@ -234,6 +235,8 @@ class Summary:
>      uses methods to generate various kinds of output. The reference
>      implementation is HTML output through mako, aptly named generateHTML().
>      """
> +    TEMP_DIR = path.join(tempfile.gettempdir(), "piglit/html-summary")
> +    TEMPLATE_DIR = path.join(os.environ['PIGLIT_SOURCE_DIR'], 'templates')

I had something a bit less manual here:

+        piglitDir = path.normpath(path.join(path.dirname(path.realpath(__file__)), os.pardir))
+        templatesDir = path.join(piglitDir, "templates")

Can we have PIGLIT_SOURCE_DIR as an override of top of this?

-- 
Damien


More information about the Piglit mailing list