I apologize since I'm somewhat new to Python. I would like to install a (setuptools-based) package, but when the scripts are installed, I would like to change the #! line.
I've found documentation that says to use -e/--executable
for this purpose, but that is not a recognized option to python3 setup.py install
. If I use it with the build
or build_scripts
commands, it works fine, but that doesn't help me install it.
When running the install command, I see it say running build_scripts
and even though I have executable
defined in setup.cfg
for build_scripts, it only seems to have any effect when I call build_scripts
explicitly, not when it's called from install.
I've found very little documentation about what setuptools
commands do - plenty of basic tutorials and several references about the various arguments to set up, but nothing about what the commands actually do or how to configure them. Any pointers would be much appreciated!
Thanks!
Edit: I did some more experiments and found that although build/build_scripts did what it was told regarding the --executable switch, the install command created an egg, and the egg-creation process rewrote the shebang line. If I use:
python3 setup.py build --executable='/usr/bin/env python3'
python3 setup.py install --skip-build --prefix=xxx --single-version-externally-managed --root=/
it works. I need to do this in two steps because --executable isn't recognized by install (though it does work with just the install if I put it in setup.cfg for build). Is this the right way to do this? It sounds like a lot of hackery for something very simple. I can't really find any documentation on what --single-version-externally-managed does. It seems to suppress egg generation, and that was causing the problem, but I don't know if that has any other effects to be aware of.