Distributing compiled (swig) python modules

Diez B. Roggisch deets at nospam.web.de
Wed Oct 15 09:00:20 EDT 2008


mathieu wrote:

> Hi there,
> 
>   I have prepared binaries of a python module that I wrote. Basically
> the lib is written in C++ and wrapped in python using SWIG. Of course
> it links to the python dynamic libraries. I found out that this is
> version dependant. For instance if I prepare the binaries on my
> machine with a python 2.4 installation this module will not load
> properly on a python 2.5 / 2.6 installation.
> 
>   Is there some documentation (that I missed in my previous google
> search) that describe how to prepare python module that can be
> redistributed with some kind of backward compatibility (= so that when
> prepared on python 2.4, it works on 2.5/2.6 at least) ?

There is no such way, and can't be because of C-API-changes in python.dlls.
You will have to offer your library separately for each python version you
support.

I don't know too much about SWIG, but if you can make your whole
build-process based on distutils or setuptools, you should be able to
produce eggs to install that your users then can install very easy.

Diez



More information about the Python-list mailing list