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

Dylan Baker baker.dylan.c at gmail.com
Wed Nov 13 12:51:27 PST 2013


On Wednesday, November 13, 2013 07:46:31 PM Damien Lespiau wrote:
> 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?

PIGLIT_SOURCE_DIR is always set in core.py in an way nearly identical to the 
way you're looking for piglitDir, which we import, so I don't think this 
should be an issue
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131113/b6b5d100/attachment.pgp>


More information about the Piglit mailing list