Unified shebang (#!), so all python utils repsect virtual envs#138
Unified shebang (#!), so all python utils repsect virtual envs#138jsha merged 2 commits intoEFForg:masterfrom
Conversation
|
Note that this kind of shebang'ing is not recommended: |
|
FWIW, there were already other python files using "env python" style. |
|
Marking as wontfix for now. |
|
This Fedora feature proposal is about python executables shipped by Fedora. The author wants to ensure that they are executed by their Fedora-default version of Python, not the one installed by user. That might make sense for their Fedora-executables to rely on Fedora-default python, but this is definitely not what you want for your scripts if you want them to be usable everywhere. Also this proposal is somewhat inconsistent. What matters is the version of Python, not the exact path. So he should have proposed to replace Ubuntu “bug” is all the same. This might make sense for distro-provided executables or maybe packagers, but this totally shouldn't worry you, developers. And especially this makes no sense for build scripts. |
|
Also note that Python upstream uses |
|
The intention for this was to allow the python utils to be run from inside a virtual env, so the exact path is what matters. As it stands now, if you run the python utils from inside a virtual env, depending on how you call the utils, some will run with the virtual env python install & libraries, and some will use the system python. If you've installed the required libraries into system python, or you're in a virtual env and call them with |
|
Based on the comments and a brief skim of the Fedora link, it sounds like this change is a good one. One question: Our scripts depend on a minimum Python version of 2.7. Is there a way to express that using the /usr/bin/env shebang? |
|
@jsha Yes, if you do #!/usr/bin/env python2.7, you'll get a 2.7 interpreter, if there is one on the system. It will also respect virtualenvs. |
|
Great! If you make that change I'll merge this branch. |
|
@jsha done! |
Unified shebang (#!), so all python utils repsect virtual envs
|
Thanks! |
No description provided.