[Distutils] Duelling SWIG patches

Greg Ward gward@python.net
Fri, 23 Jun 2000 22:03:41 -0400


On 23 June 2000, Thomas Heller said:
> I don't like this patch.

Well, at least you're up-front and honest.  ;-)

> While I won't argue whether ccompiler is an appropriate superclass
> for swig, swig shares some important properties:
> 
> Swig has command line flags to specify include directories -I<dir>,
> libraries -l<ifile>, define symbols -Dsymbol like C-compilers.
> Other options which are maybe usefull for python extensions
> are -t <typemap file>, -shadow (create shadow classes),
> -module name (set module name) and maybe more.

All true.  *BUT* SWIG doesn't vary across platforms, there aren't
multiple SWIG implementations to worry about, and therefore there's no
need for an "abstract SWIG interface".

> From this I have the impression that swig should be a separate class
> implemented in swig.py, and there should be distutils command line
> flags for setting the above options (and also the -c++ option).
> Although I did not implement them so far.

I'll buy that.  I make no claim that my SWIG patch has anywhere near
enough support for running SWIG in the real world; I suspect that adding
such support will make it grow up into a real class.  But that class
really has no need to implement the CCompiler interface.  Nor should it,
since SWIG is not a C compiler: it's a SWIG interface file compiler.

> (Sidenote: I also needed a swig-object in build_ext for my setup-script
> for win32all. I had to extend distutils in the setup-script
> because there are also exe-files to be built from C++
> and swig sources).

I thought I mentioned this recently: there *is* a 'link_executable()'
method in MSVCCompiler.  If it works, why not use it?  If it doesn't
work, could you submit a patch instead of implementing your own?  (And
if the interface specified by CCompiler is insufficient, I'd like to
find out *now*!)

> As I pointed out in a separate post, there should also be an option
> to specify C or C++ processing.

Agreed -- yet another good argument for a SWIG class.

> If I find time, I will submit a new patch.

Cool.  My time is probably better spent learning SWIG.  No wait, I mean
documenting and testing the Distutils... sigh...

        Greg
-- 
Greg Ward - Linux nerd                                  gward@python.net
http://starship.python.net/~gward/
I don't believe there really IS a GAS SHORTAGE.. I think it's all just
a BIG HOAX on the part of the plastic sign salesmen -- to sell more numbers!!