[Numpy-discussion] [review] py3k_bootstrap branch

David Cournapeau cournape@gmail....
Tue May 5 04:33:09 CDT 2009


Hi,

I spent some more time on making numpy.distutils runnable under python
3. I finally made up to the point where it breaks at C code
compilation, so we can start working on the hard part. The branch is
there for review

http://github.com/cournape/numpy/commits/py3k_bootstrap

The code is quite ugly to be honest, but I have not found a better
way; suggestions are welcomed. The biggest pain is by far exception
catching (you can't do except IOError, e in python 3), and then print.
Most other things can be handled by careful application of 2to3 with
the fixers which keep python2 compatibility (print is unfortunately
not one of them). There are also a few python 3.* bugs in distutils (I
guess few C-based extensions made it for python 3 already).

The rationale for making numpy.distutils runnable under both python2
and python3 (instead of just applying 2to3 on it):
 - it enables us to bootstrap our build process through the distutils
2to3 command (which is supposed to convert code to python 3 from
python 2 sources on the fly).
 - The few informations I found on non trivial port all made sure
their setup.py was python 2 and 3 compatible - which means
numpy.distutils for us.
 - 2to3 is very slow (takes 5 minutes for me on numpy), so having to
apply it every time from pristine source for python 3 support would be
very painful IMHO.

cheers,

David


More information about the Numpy-discussion mailing list