[Distutils] Wanted: ideas for using distutils with preprocessors/dependencies

M.-A. Lemburg mal at egenix.com
Mon Jul 18 09:47:25 CEST 2005

Hi Jack,

Jack Jansen wrote:
> I'm currently looking at integrating bgen with distutils.
> ...
> But now I'm at a loss as to how to proceed. I had a look at how swig  
> is integrated into distutils, and I don't really like it, it smells  
> like a hack. And, according to the comments in the source and the  
> manual, the author agrees with me:-) Swig support is basically done  
> in the build_ext command, by filtering out all ".i" files in the  
> source file list very early in the process, running swig on them, and  
> replacing them by the .c or .cpp equivalents.
> I can see various ways of adding bgen support, but I'm not sure which  
> one is the best one, and/or whether there are other options. So I'd  
> be interested in hearing what other people think, and how other  
> packages have added a preprocessor to distutils.

Due to the natur of distutils, it is easily possible to add
a few more stages to the build process here and there.

If you just want to do some extra processing before building
an extension, the simplest way to hook into the process is
by extending build_ext.

If you want your command to get automatically checked and
processed, you have to subclass the build class itself and
add the command as sub-command.

For examples on how this can be done, have a look at mxSetup.py
which you can find in egenix-mx-base.

It has support for auto configuration, building Unix libraries
and various other things we needed in distutils. Works great
and distutils made it easy to add the new features to our

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Jul 18 2005)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Distutils-SIG mailing list