Simon Busard | 12 Jun 2012 12:41
Picon
Favicon

SWIG and Python - Multiple modules with the same name

Hello,

I'm trying to build a Python wrapper for a large program using SWIG. 
This program is divided into packages, one directory per package.

To build the wrapper, I created and filled a SWIG interface (.i file) 
for each package, including header files of the packages. I created the 
shared library by hand and I use distutils to build one extension for 
each Python package corresponding to program packages.

My problem lies in the fact that there are some program sub-packages 
that have the same name, but they lie in different directories. When 
using distutils to build the extensions, the SWIG documentation tells to 
build extensions in place (by using --inplace option of setup.py 
build_ext). The problem is the following: when building extensions, .so 
files are built in the current directory, and packages with the same 
names lead to .so files with the same name, leading to a conflict.

Here after is a little example illustrating my problem.

I have a library grlib, with two packages "automaton" and "graph". In 
these two packages are two sub-packages named "state". In these packages 
lie the headers and .c files.

grlib/
     automaton/
         state/
             state.h
             state.c
             state.i
(Continue reading)


Gmane