3

I use distutils to compile a swig-based extension module:

python setup.py build_ext produces the file _my_module_ext.cpython-32m.so (from a .c and a .i file). This name appears to depend on the python version used (in my case, it's python 3.2).

How can I access the name of this shared-object from within setup.py or even from within a module in the installed package?

The reason I need this is, that I have a separate, ctypes-based python-file that wants to load this file using numpy.ctypeslib.load_library.

thias
  • 2,290
  • 3
  • 20
  • 20

1 Answers1

4

The suffix is available through sysconfig.get_config_var('SO'). Read more about ABI-tagged shared libraries at PEP 3149.

nneonneo
  • 171,345
  • 36
  • 312
  • 383