Best way to specify path to binary for a wrapper module
<p>I write a module that wraps functionality of an external binary.</p>

<p>For example, I wrap <code>ls</code> program into a python module <code>my_wrapper.py</code></p>

<pre><code>import my_wrapper
print my_wrapper.ls('some_directory/')
# list files in some_directory
</code></pre>

<p>and in my_wrapper.py I do:</p>

<pre><code># my_wrapper.py

PATH_TO_LS = '/bin/ls'

def ls(path):
    proc = subprocess.Popen([PATH_TO_LS, path], ...)
    ...
    return paths
</code></pre>

<p>(of course, I do not wrap <code>ls</code> but some other binary)</p>

<p>The binary might be installed with an arbitrary location, like <code>/usr/bin/</code>,  <code>/opt/</code> or even at the same place as the python script (<code>./binaries/</code>)</p>

<p><strong>Question:</strong></p>

<p>What would be the cleanest (from the user perspective) way to set the path to the binary?</p>

<ul>
<li>Should the user specify <code>my_wrapper.PATH_TO_LS = ...</code> or invoke some <code>my_wrapper.set_binary_path(path)</code> at the beginning of his script?</li>
<li>Maybe it would be better to specify it in <code>env</code>, and the wrapper would find it with <code>os.environ</code>?</li>
<li>If the wrapper is distributed as egg, can I require during the installation, that the executable is already present in the system (see below)?</li>
</ul>

<p>egg example:</p>

<pre><code># setup.py
setup(
    name='my_wrapper',
    requires_binaries=['the_binary'] # &lt;--- require that the binary is already 
                                     #      installed and on visible
                                     #      on execution path
)
</code></pre>

<p>or</p>

<pre><code>easy_install my_wrapper BINARY_PATH=/usr/local/bin/the_binary
</code></pre>
