[Piglit] Convert from python2 to python3

Dylan Baker baker.dylan.c at gmail.com
Mon Feb 24 13:19:59 PST 2014


On Monday, February 24, 2014 02:47:32 PM Ilia Mirkin wrote:
> On Mon, Feb 24, 2014 at 2:42 PM, Dylan Baker <baker.dylan.c at gmail.com> 
wrote:
> > This series makes the transition from python2 to python3. In general
> 
> Out of curiousity, what's the motivation for this? I've been able to
> avoid python3 quite nicely thus far, all it seems to do is break
> compatibility with existing setups... Admittedly piglit is targeted at
> developers, who probably have the latest and greatest stuff, so
> perhaps not a huge issue.
> 
Two reasons: Features, and future support.

Python 2.7 is effectively in maintenance-until-EOL mode. There is no 
development being done against it, and there are features going into python 3 
that are interesting.

Namely:
string/byte/unicode madness sorted
thread timeouts

> > 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.
> > 
> > 
> > _______________________________________________
> > 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/20140224/1e41a43f/attachment.pgp>


More information about the Piglit mailing list