I am building a python package that depends on a C library, which will be called via ctypes. In setup.py, I have:
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py as _build_py
class BuildPyCommand(_build_py):
def run(self):
# download source files and cmake/make
# the result is, say "/lib/libexample.so"
setup(...,
cmdclass={"build_py": BuildPyCommand}
)
When I tried pip install ., the above setup.py was able to compile /lib/libexample.so in the project folder.
Then, now what? How can I make /lib/libexample.so part of the pip installation? Is the above code sufficient?
How should I specify the location of libexample.so for ctypes commands in my package source code?