Search code examples
pythonpackagingsetuptools

How do you specify the shebang line of a command script created by setuptools


I have created a package that I will be distributing throughout the company that replaces a legacy bash script with the same name. It is referenced many places so it needs to execute like the current script does. This has worked fine until I encountered some servers that do not have a current version of Python as the default Python (aka CentOS).

Is there a way to specify in the setup.py what shebang line is created at the top of the script file? i.e. I need #!/opt/bin/python rather than #!/usr/bin/env python.


Solution

  • The answer to my question was answered by Keith. Running the setup.py as /opt/bin/python setup.py install produces the results I need without any user intervention.