[Distutils] CCompiler signature

M.-A. Lemburg mal@lemburg.com
Wed Feb 6 08:08:02 2002

"Anders J. Munch" wrote:
> I'm considering writing a no-op CCompiler implementation that instead
> of actually compiling anything just outputs which files would have
> been compiled and with which options.  The idea is that I'd take this
> information and add the files to Setup.local manually, in order to
> produce a statically linked executable.  (See
> <news:3c5fe73f$0$204$edfadb0f@dspool01.news.tele.dk> on why I want to
> do that.)
> But reading ccompiler.py I can't figure out what which signature such
> a class should implement.  CCompiler claims to be an abstract base
> class but is in reality jam packed with implementation.  So which
> methods are utility methods that can be ignored and which are part of
> the interface which must be implemented for distutils to work?  Does a
> compiler implementation class have to derive from CCompiler?

It probably should since CCompiler is not an abstract class, but
a base class with lots of working method implementations.
> I presume that adding a module with a CCompiler derived class and
> giving it an entry in compiler_class is sufficient to implement a new
> compiler for distutils, am I right?  I wish there was an overview
> document to explain the distutils architecture.

I'd try to take one of the existing compiler modules and
simply replace the compile and link methods with implementations
which write the information you require to some external file.
To register the compiler, you'll only have to edit the ccompile.py
file -- gee, I wish there was a better way to tweak the compiler
settings in distutils via the setup() entry API.

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/