[Pyrex] Newbie Question

Greg Ewing greg at cosc.canterbury.ac.nz
Fri Apr 16 04:06:22 CEST 2004


Michael <mike at pcblokes.com>:

> What's worse - I will need to learn the magic compiler chain
> incantations that I have avoided for so long.

You can avoid most of that by using distutils to build your
extension. Pyrex comes with a distutils extension that knows about
.pyx files.

> I've got the MinGW package with gcc - which is probably the *best*
> free compiler - although I understand there are issues with easily
> using it for pyrex/win32.

Distutils can use MinGW. You just need to say

  python setup.py build_ext --compiler=mingw32

The only tricky part is that you need to use a couple of command-line
tools to create a MinGW version of the Python DLL for linking the
extension against. There are instructions for doing this in the Python
distutils documentation. You only need to do it once for any given
Python version.

> Has anyone any experience of doing this ?

Yes, I've done it myself recently, and it works fine.

> Can compiled extensions be distributed for use by people without MinGW
> *and* without dependency on an extra dll as a result of using this
> method ?

Yes.

> Will my resulting binary be free of GPL restrictions ?

Yes.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list