My Python module contains an external script that users can execute from the command line. I'd like users to be able to install the Python module and script all in one go. Using setuptools, I have tried adding:
scripts=['bin/mybin']
which almost does the trick. Instead of adding mybin
to the user's PATH, it adds a small script that calls mybin
:
#!/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
# EASY-INSTALL-SCRIPT: 'myscript==2.0.4','mybin'
__requires__ = 'myscript==2.0.4'
__import__('pkg_resources').run_script('myscript==2.0.4', 'mybin')
This indirection is causing some problems, notably a small lag when the script is executed (compared to copying mybin
to the PATH directly).
Is there any way to have setuptools copy the script directly to the PATH rather than have it call my script indirectly?
My first thought is to write a custom post-install function to copy the script to the user's path. But if there is a way to do this natively in setuptools, I would prefer that.