Compiling applications in setup.py

If you need to compile a random application in setup.py this is not that hard:

cc = distutils.ccompiler.new_compiler()
distutils.sysconfig.customize_compiler(cc)
cc.link_executable(['test.c'], 'a.out')

There is no need to create the object files explicitly with cc.compile() first if you have no need for them, the command line invoked by .link_executable() will do the compilation step in one go for you.

This part of distutils is actually documented, so check it out, you can pass in many optional arguments and modify the compiler object to customize things.