hi, On 23.8.2016 13:54, Christian Boltz wrote:
Hello,
Am Montag, 22. August 2016, 15:23:08 CEST schrieb jan matejek:
I like this idea. I'll see what I can do about making it work. ISTM you basically only need to substitute the correct executable? Possibly mess with what "env python" returns, but OTOH perhaps we should run the scripts with an explicit interpreter, and consider "env python" a bug... which we've been quietly doing since forever.
You are raising an interesting detail here - shoud python scripts have #!/usr/bin/python3 or #!/usr/bin/env python3 ?
Both work, but I wonder if (and why) one of them is "better". Can you give some insights, please?
This is rather clear-cut: for (almost) everything *we* as the distribution provide, "#!/usr/bin/python3" is correct and the "env" variant is incorrect. The reason being, "/usr/bin/env python3" will happily pick up whichever hand-built version of python the user has placed in their $PATH (or $python3). This is also the purpose of using the "env" construction: as an ISV you can't know whether /usr/bin/python3 exists, or is it in /usr/local, or somewhere in /opt, or maybe in the user's home... However, the programs that we provide must run against the runtimes that we provide -- hence, explicit path. (The users still have the option of executing /opt/myworkspace/bin/python3 script.py, skipping the shebang line altogether.) ...the situation in the build environment is less clear-cut, as the scripts that run during the build are not yet "provided by us"... that's why i was considering messing with the result of env.
(I used python3 for the example, but the same question applies to python 2.)
At this point in time, we really should be turning the scripts from /usr/bin/python to /usr/bin/python2. Or making sure that they can run with python3, which is bound to become /usr/bin/python sooner or later. hope this helps m.
Regards,
Christian Boltz