Is there a preferred way to do this?
In my experience with other people's modules, I can say that there is certainly no consensus on the right path for this.
I tried and rejected the subclassifying bits of distutils - I found it fragile and difficult to work on different versions of Python and different systems.
In our code, after checking the types of things you are considering, I decided to install and configure directly in setup.py before the main setup() call. This is admittedly a little ugly, but it means that someone who is trying to compile your stuff has one place to figure out, for example. why the inclusion path is wrong. (And they, of course, don't need to be experts on internals of distutils).
Ross kinder
source share