[Distutils] conditionally compiling extensions
radix at twistedmatrix.com
Thu Mar 8 17:39:42 CET 2007
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.
International Man of Twistery
More information about the Distutils-SIG