gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ✘python shebang, yet again


From: Greg Troxel
Subject: Re: ✘python shebang, yet again
Date: Thu, 24 Sep 2020 18:56:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix)

"Gary E. Miller" <gem@rellim.com> writes:

> One way to build gpsd for a python that is not the current python
> is to use target_python.  So if you default Python is 2.7, and you
> want to build for Python 3, do this:
>
> scons config=force target_python=python3
>
> But that leaves the python shebang in the gpsd python clients to be the
> PEP 394 default:
>
>     #!/usr/bin/env python

Indeed, PEP 394 appears to exist in an alternate universe from people
that actually make packaging systems work!

> You fix that by using the pyshebang option:
>
> scons config=force target_python=python3 python_shebang="/usr/bin/env python3"

Agreed this is how it is now; pkgsrc does:

  # Use the python chosen by pkgsrc, not "/usr/bin/env python"
  SCONS_ARGS+=    python_shebang=${PYTHONBIN}
  SCONS_ARGS+=    target_python=${PYTHONBIN}

(which makes the shebang not have env).

> The suggest has been made that is target_python is given, but
> python_shebang is not, that the target_python be used to change the
> python_shebang default.
>
> So for:
>
> scons config=force target_python=python3
>
> The python shebang would be:
>
> #!/usr/bin/env python3
>
> And for:
>
> scons config=force target_python=/usr/bin/python3
>
> The python shebang would be:
>
> #!/usr/bin/env /usr/bin/python3

That makes sense to me, except that the target python should be a full
path, and there is no need to use env.  The shebang would then be

#!/usr/bin/python3

> Of course the user can over-ride the new defaults with python_shebang.
> So to get PEP 394 default behavior back:
>
> scons config=force target_python=python3 python_shebang="/usr/bin/env python"

That's a bad idea, but good that people that want that can do it without 
patching.

> Comments?  Suggestions?

I know I'm an outlier, but I think that a particular python version --
which means a fully-qualified path to an actual version, not pyhon, not
python2, not python3, but something like /usr/pkg/bin/python3.7, or
/usr/bin/python3.8 -- should be found at configure time and substituted
in.  So I think that what you describe is a big step in the right
direction, arguably 90% of the right step in that packaging systems
putting in scons args is painless compared to having to patch.

I think that python_shebang needs to be usable to force the shebang to
not use env, even if that isn't the default.  But I don't see anything
in your proposal that changes that; you are only proposing an
incrementally more sensible default.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]