Distribute a Python package with a compiled dynamic shared library : <p>How do I package a Python module together with a precompiled <code>.so</code> library? Specifically, how do I write <code>setup.py</code> so that when I do this in Python</p>

<pre><code>&gt;&gt;&gt; import top_secret_wrapper
</code></pre>

<p>It can easily find <code>top_secret.so</code> without having to set <code>LD_LIBRARY_PATH</code>?</p>

<p>In my module development environment, I have the following file structure:</p>

<pre><code>.
├── top_secret_wrapper
│   ├── top_secret.so
│   └── __init__.py
└── setup.py
</code></pre>

<p>Inside <code>__init__.py</code>, I have something like:</p>

<pre><code>import top_secret
</code></pre>

<p>Here's my <code>setup.py</code></p>

<pre><code>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,
)
</code></pre>

<p>I'm sure my <code>setup.py</code> is lacking a setting where I specify the location of <code>top_secret.so</code>, though I'm not sure how to do that.</p>
