[Distutils] conditionally compiling extensions

Phillip J. Eby pje at telecommunity.com
Thu Mar 8 20:06:50 CET 2007


At 11:39 AM 3/8/2007 -0500, Christopher Armstrong wrote:
>On 3/5/07, Christopher Armstrong <radix at twistedmatrix.com> wrote:
> > Before showing what these hacks are (if you really care, you can check
> > the various setup.py files in the Twisted repository), I'd like to ask
> > if there is any other best-practice knowledge in the community for
> > conditionally building extensions based on knowledge only available by
> > using a compiler.
>
>
>Ok, here's what I think I'm going to do.
>
>Subclass Extension to have an extra method, shouldBuild, which is
>called by build_extension by my subclass of build_ext. It will filter
>out any extensions for which shouldBuild returns False. This way
>extensions will still be declared ahead of time and so no early-out
>code will be problematic.
>
>Probably my subclass of Extension will take a callable in its
>initializer to use as the default implementation of shouldBuild.
>
>I'll try this out soon.

Sounds nice.  When you're done, can I steal it for setuptools?  :)



More information about the Distutils-SIG mailing list