SWIG/distutils question

Magnus Lie Hetland mlh at furu.idi.ntnu.no
Sat Jun 14 15:08:54 CEST 2003

I just upgraded SWIG and got trouble with distutils... Previously, I
could simply list the extension, with the proper .c and .i files...
Now, however, it seems that SWIG has started building .py wrappers for
the extension. For a file foo.c, this wrapper is (per default) called
foo.py, and imports an extension called _foo (e.g. _foo.so). This is
(sort of) OK, I guess -- the problem is that the default name for the
extension is foo.so, not _foo.so! (At least that's what I get.) This
seems so stupid, I suspect it must be my own fault...

Anyway -- on the command-line one can explicitly override the default
to give the correct _foo name, but how does one do that in distutils?
And how does one make sure the foo.py file is installed? List it as a
module? I suppose that will be safe, since build_ext (which actually
builds foo.py) must be run before install anyway, but it sounds a bit
weird... Even though I don't like this new behaviour of automatically
generating .py files, I guess the main question is to which degree
distutils is in sync with SWIG at the moment... (I could always run
SWIG separately from distutils, of course, so this is not critical.)

Magnus Lie Hetland                "In this house we obey the laws of
http://hetland.org                 thermodynamics!"    Homer Simpson

More information about the Python-list mailing list