Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include .so file when build .egg with setuptools

How can I build an .egg file include a '.so' file?

here is my file tree: --setup.py --__init__.py --mcpack.py` --mcpack.so

how can I make a package with mcpack.so in it?

I've tried using pack_data, it turns out .so file is packaged but not findable in python file.

like image 271
Rachel Geller Avatar asked Jul 10 '17 14:07

Rachel Geller


1 Answers

Put it in native_libs.txt and build the egg with bdist_egg, see this section of the documentation. You should, however, switch to wheels instead of eggs.

Shared object files are only distributable if you can guarantee the exact same tool chain that was used to build your .so is also present in every other distribution that is going to run it - this is highly unlikely and would break the distributable nature of egg files, that is unless you really only want to target a specific version of a Linux distribution.

Your egg, if installed in any other distribution than the one the .so was built on will not be able to be used.

If you want to build a distributable package containing native code have a look at wheel files and for wheels that can be distributed to all Linux OSs, have a look at manylinux.

like image 110
danny Avatar answered Oct 29 '22 03:10

danny