Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating python c module independent of python version?

Tags:

python

module

tcl

In Tcl, there is a concept of stubs, where you can have a C extension that works with any compatible version of Tcl. Is there a comparable concept for Python?

I'd like to distribute a binary module that would run on Ubuntu 8.04 (python 2.5), Ubuntu 10.04 (python 2.6), and Centos 5 (python 2.4). I'd like to only have to distribute a 32 bit and a 64 bit version for Linux that would be compatible with all 3. I'd redistribute libstdc++ and compile for glib 2.7 which is forward compatible with glib 2.11.

like image 223
Juan Avatar asked Oct 14 '22 19:10

Juan


1 Answers

If you distribute your module as source, it can be compiled as necessary.

This problem occurs a lot with Windows, for which modules are normally distributed as binaries. PEP 384 proposes a solution (a limited interface which is guaranteed to exist for all Python 3 versions) and is implemented in Python 3.2. Until then, you're stuck.

like image 165
Katriel Avatar answered Oct 24 '22 23:10

Katriel