[Distutils] Revised design proposal

Martijn Faassen M.Faassen@vet.uu.nl
Tue, 19 Jan 1999 16:41:36 +0100

[argh..I keep forgetting 'reply' in Netscape doesn't work when posting
to a mailing list, only when posting to a newsgroup. Second try. Sorry
for Fred who gets it twice.]

"Fred L. Drake" wrote:

> Greg Ward writes: 
>  > ...well, that's a start.  I still don't know how to make all those
>  > Unixish C compilation variables more cross-platform.

You don't expose Unixish C compilation variables to the user at all,
perhaps? At least in principle. In practice you'd still allow
modification, but it shouldn't be *necessary* to look at these or even
know about them, even to write a C extension. (unless you're on some new

As we talked about before:

* Make an abstract compiler class that can do simple C (and perhaps C++)
compilation and linking. Subclass for each desired platform (or
platform+compiler combination, such as win95-cygwin, or

* Each compiler subclass just has a bunch of plausible default options
for optimization (-O2 for gcc, for instance).

Mind that we're not trying to build an entire compiler/linker
abstraction. We just need enough to compile and link for Python. 

This way the extension writer does not need to even think about compiler
options for a zillion platforms when making the module. The compiler
class for the platform knows anyway.

Linking in external libraries is a stickier point that we need to talk
about some more. We need a way to specify 'external' resources for
modules. These would be Python independent C libraries that your module
makes use of. The distutils build system wouldn't need to know about
building these; it just needs to know how to compile and link C (and
C++) files to work as Python modules. The distutils should allow a way
for a module distribution to check for presence of the external
resources, and to issue build commands to external libraries. The
external libraries are expected to be equipped with platform independent
build systems anyway.

Of course the extension writer should be able to supply special
information for each platform *if desired*. If you know
--funroll-all-loops or whatever will optimize your module even further
using gcc on Linux, you can replace the default linux-gcc compiler class
with your own specialized one.

>   Meta-comment:  I am very concerned that the non-Unix crowd doesn't
> seem to be involved with this project.  Is there any way to make them
> aware of the effort?

I consider myself part of the Unix crowd, though I'm currently using
Python on a Windows machine at work. I imagine there's only the regular
way of making people aware of this effort, posting to the newsgroup and
announcing on the website.

Perhaps a special 'distutils SIG' status report, posted once every while
and updating everybody on developments would be useful to attract
interest. And what about something in the Python Journal?