[Piglit] Convert from python2 to python3
Dylan Baker
baker.dylan.c at gmail.com
Mon Feb 24 11:42:37 PST 2014
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.
More information about the Piglit
mailing list