[Piglit] Convert from python2 to python3

Dylan Baker baker.dylan.c at gmail.com
Tue Feb 25 13:05:07 PST 2014


On Tuesday, February 25, 2014 03:53:57 PM Tom Stellard wrote:
> On Mon, Feb 24, 2014 at 11:42:37AM -0800, Dylan Baker wrote:
> > This series makes the transition from python2 to python3. In general
> > this is done via the 2to3 utility provided by the python project,
> > however, there are some cases that have been further edited, usually
> > becasue 2to3 is very fond of replacing iterators with list(iterator).
> > 
> > I have targeted python 3.3 as the version, it is the latest stable
> > version of python (3.4 is expected this year), and provides a number of
> > features that would be very useful, like the ability to implement test
> > timeouts trivially.
> > 
> > There are some interesting changes between the two versions worth
> > pointing out:
> > 
> > 1) Everything is an iterator. If you need a list returned that must be
> > 
> >    done explicitly.
> > 
> > 2) Int and Long have been joined into a single class. This has
> > 
> >    interesting implications for the generated tests where numpy is not
> >    used.
> > 
> > 3) Python3 does not format floats the same way. It is probably better to
> > 
> >    use numpy anyway
> > 
> > 4) mixing spaces and tabs in python2 generates a runtime warning, in
> > 
> >    python3 it generates an runtime exception.
> > 
> > 5) Numerous broken things in python2 are fixed in python3
> > 
> > Patches 1-2: Lay groundwork to ease the transition
> > Patch 3:     Converts framework to python3 this is a clean transition
> > 
> > 			 and shouldn't cause any problems
> > 
> > Patch 4:     Changes the generators. There are definately some changes
> > 
> > 			 here that might be problematic
> > 
> > Patch 5:     Converts CMakeLists to use python3.3 instead of python2
> > 
> > 
> > Jose: I have cc'd you becasue I couldn't find a quick and easy fix for
> > framework/junit.py, which IIRC you wrote and maintain seperatly from
> > piglit, do you have a python3 version?
> > 
> > Tom: I cannot test the CL generated tests, my r600 machine is not
> > working at the moment, and I have noticed a loss of 5 points of
> > percision on a number of tests, if that is a problem I will convert the
> > CL generators to use numpy instead.
> 
> I just run the OpenCL tests with your python3-merge branch.  I've attached
> a patch to fix a crash in the opencv tests.  I'm also getting an error
> when trying to run piglit-summary-html.py:
> 
> Traceback (most recent call last):
>   File "./piglit-summary-html.py", line 98, in <module>
>     main()
>   File "./piglit-summary-html.py", line 94, in main
>     output.generate_html(args.summaryDir, args.exclude_details)
>   File "/home/tstellar/piglit/framework/summary.py", line 385, in
> generate_html
>     lspci=each.lspci))
>   File "/usr/lib/python3.3/site-packages/mako/template.py", line 311, in
> render_unicode
>     as_unicode=True)
>   File "/usr/lib/python3.3/site-packages/mako/runtime.py", line 661, in
> _render
>     **_kwargs_for_callable(callable_, data))
>   File "/usr/lib/python3.3/site-packages/mako/runtime.py", line 693, in
> _render_context
>     _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
>   File "/usr/lib/python3.3/site-packages/mako/runtime.py", line 719, in
> _exec_template
>     callable_(context, *args, **kwargs)
>   File
> "/tmp/piglit/html-summary/home/tstellar/piglit/templates/testrun_info.mako.p
> y", line 28, in render_body
>     __M_writer(unicode(name))
> NameError: global name 'unicode' is not defined
> 
> I think this may be a configuration problem on my end, so I'm going to
> try a clean rebuild.  If you have any ideas about what's wrong, let me know.
> 
> -Tom

try deleting /tmp/piglit, I think you probably have cached mako python files 
that are python2 and being loaded by python3

> 
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- 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/20140225/4b1cdd84/attachment.pgp>


More information about the Piglit mailing list