Python 3.x Porting Notes

Decided to see how much work getting PyOpenGL ported to Python 3.x would be.  Notes so far:

  • ubuntu has Python 3.1 packaged (yay)
  • also has distribute and -dev, you'll need both
  • virtualenv -- this is key for my porting work-flow (not just for PyOpenGL, for almost every project), had to use an hg branch to get it working
  • numpy can be built from svn for Python 3.1
  • just added a flag to setup so that 2to3 would get run for Python 3 installs via easy_install
  • got lots of NameErrors where I was cleaning up (deleting) loop vars after the loops, added try:except NameError around those
  • str array support will need to be reworked slightly, may as well support arbitrary buffers while we're at it (we use Python-API calls to get the string pointer, may as well allow passing any buffer-protocol-supporting instance)
  • didn't try building the accelerator modules
  • without pygame, the built-in tests won't run, didn't feel like building pygame from svn just to test this
  • GLUT-only demos do run, all looks to be working properly, save that without string support shaders can't be compiled (they are passed as arrays-of-strings).
  • Demo code isn't currently easy_installed, so we don't get free 2to3 support there
Which is about where I ran out of interest.  All the code changes to work with Python3 so far were compatible with Python2.  Updating/fixing the string/buffer support should be straightforward, I can actually write a different plug-in and only register that one for Python 3.x.  Cython should, I believe, be Python 3.x compatible already, so even the accelerator modules should be pretty easy to port.  Still doesn't seem that we're at a point where Python 3.x is ready for PyOpenGL, though, but when it does get here we should be in pretty good shape.  OpenGLContext will be a lot more work, as it requires PyVRML97 and SimpleParse, both of which have hand-coded C extensions that aren't even ported to 2.7 yet.

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.