Build python wheel with precompiled shared library

473 views Asked by At

When building a wheel of a Python extension module, how can I tell setup() to use an existing/precompiled shared library?

For awful horrible reasons, the SO/DLL has to be compiled by a build system that cannot be invoked by Python. (FWIW it's compiled with the stable limited ABI.) But I need my setup.py to bundle the library correctly.

Is there an option for this? Is it possible to subclass Extension somehow and just return the existing library when asked to build it?

1

There are 1 answers

1
Nopileos On

You can create a MANIFEST.in (https://packaging.python.org/en/latest/guides/using-manifest-in/) and include the files when creating a wheel this way.

So if you got all the shared libs somewhere in the source tree you can do

global-include *.so