How do I package a Python module together with a precompiled .so
library? Specifically, how do I write setup.py
so that when I do this in Python
>>> import top_secret_wrapper
It can easily find top_secret.so
without having to set LD_LIBRARY_PATH
?
In my module development environment, I have the following file structure:
.
├── top_secret_wrapper
│ ├── top_secret.so
│ └── __init__.py
└── setup.py
Inside __init__.py
, I have something like:
import top_secret
Here's my setup.py
from setuptools import setup, Extension
setup(
name = 'top_secret_wrapper',
version = '0.1',
description = 'A Python wrapper for a top secret algorithm',
url = None,
author = 'James Bond',
author_email = 'James.Bond.007@mi6.org',
license = 'Spy Game License',
zip_safe = True,
)
I'm sure my setup.py
is lacking a setting where I specify the location of top_secret.so
, though I'm not sure how to do that.