[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ✘python shebang, yet again
From: |
Gary E. Miller |
Subject: |
Re: ✘python shebang, yet again |
Date: |
Thu, 24 Sep 2020 20:02:20 -0700 |
Yo Fred!
On Thu, 24 Sep 2020 19:50:36 -0700 (PDT)
Fred Wright <fw@fwright.net> wrote:
> 3) A relative path (though this would be pretty weird).
Yes, weird.
> 3) Otherwise (i.e. it contains os.path.sep but doesn't start with
> it), then consider it to be a relative path. Convert it to an
> absolute path and use it as in #2.
As you say, that is weird, but common with cross-building. In that case
you do not want the cross-build python in the shebang.
If someone wants a wwird case they can use python_shebang.
> > (The point of using a full path is to bind to a particular python
> > build at gpsd configure/build time, rather than having it end up
> > using one at runtime that may or may not have been changed. But
> > I've said that before, and the PEP people don't value that
> > property.)
>
> Remember that PEP 394 was written to address the specific issue of
> Python 2 vs. Python 3 and programs that would only work with one,
Ah, no. I suggest you re-read it. Especially CPython section:
https://www.python.org/dev/peps/pep-0394/#application-to-the-cpython-reference-interpreter
> and
> didn't consider such issues as third-party libraries and their
> locations at all.
A agree, there are other PEPs for those issues.
> Nevertheless, it does state that more specific
> versioning is preferable to less specific versioning,
I read it exactly the opposite that you do.
> so if one
> considers the full absolute path to the Python interpreter as the
> most specfic versioning of all, then that should actually be
> considered ideal by PEP 394. :-)
If so, then you would expect them to say so, or have one example of that.
It does not.
> Using the absolute path is the most robust approach, since it defends
> against future changes to PATH and/or the symlink that something like
> 'python3' probably refers to.
And breaks things like moving from /bin to /usr/bin, and back, which
some distros do.
> There's an enhancement I've used in
> another context to make this more convenient, where prefixing the
> target_python argument with '@' causes it to use the target python's
> sys.executable for the shebang.
This was already discussed at length NTPsec. It breaks a lot of
distributions. It breaks Gentoo.
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
gem@rellim.com Tel:+1 541 382 8588
Veritas liberabit vos. -- Quid est veritas?
"If you can't measure it, you can't improve it." - Lord Kelvin
pgpc_8Fk9NWQw.pgp
Description: OpenPGP digital signature
- ✘python shebang, yet again, Gary E. Miller, 2020/09/24
- Re: ✘python shebang, yet again, John Ackermann N8UR, 2020/09/24
- Re: ✘python shebang, yet again, Greg Troxel, 2020/09/24
- Re: ✘python shebang, yet again, Gary E. Miller, 2020/09/24
- Re: ✘python shebang, yet again, Greg Troxel, 2020/09/24
- Re: ✘python shebang, yet again, Gary E. Miller, 2020/09/24
- Re: ✘python shebang, yet again, Fred Wright, 2020/09/24
- Re: ✘python shebang, yet again,
Gary E. Miller <=
- Re: ✘python shebang, yet again, Greg Troxel, 2020/09/25
- Re: ✘python shebang, yet again, Gary E. Miller, 2020/09/26