A hack to let Pyrex 0.3.x users build extension classes on Win32

Matthias Baas baas at ira.uka.de
Mon Jul 8 02:25:54 EDT 2002


On Fri, 5 Jul 2002 13:42:45 -0700, "David LeBlanc" <whisper at oz.net>
wrote:
>Making pyrexc use native (Visual C) compiler:
>[...]

I think the easiest way to compile Pyrex modules (either on Windows,
Linux or anything else) is by using the distutils. For example, to
compile the file shrubbery.pyx you just need the following setup.py
script (which assumes you have "pyrexc" somewhere in your path):

#########################################

from distutils.core import setup, Extension
import os

os.system("pyrexc shrubbery.pyx")

setup(name="shrubbery",
      ext_modules=[Extension("shrubbery", ["shrubbery.c"])])

#########################################

Now you can compile the module with "setup.py build" or "setup.py
install" and then the distutils take care of the build process. 
The nice thing is, that you don't have to set any paths (unless you
need custom libraries/header files) and that it works on any platform.
However, I don't know if the distutils can also be used for other
compilers than Visual C++ on Windows.

- Matthias -




More information about the Python-list mailing list