thias
thias

Reputation: 2450

python distutils: access to name of compiled extension

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.

Upvotes: 3

Views: 303

Answers (1)

nneonneo
nneonneo

Reputation: 179687

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

Upvotes: 4

Related Questions