emacs-devel
[Top][All Lists]
Advanced

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

Re: master 7f0a252f216 1/2: Prefer python3 for python-interpreter


From: Augusto Stoffel
Subject: Re: master 7f0a252f216 1/2: Prefer python3 for python-interpreter
Date: Fri, 27 Sep 2024 20:43:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Fri, 27 Sep 2024 at 00:59, Xiyue Deng wrote:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> -(defcustom python-interpreter "python"
>>> +(defcustom python-interpreter
>>> +  (cond ((executable-find "python3") "python3")
>>> +        ((executable-find "python") "python")
>>> +        (t "python3"))
>>
>> Stefan, are you sure this change is for the better?  python3 is not
>> guaranteed to be available (e.g., it isn't on my system), so the above
>> is a net loss for such systems.  Bug#70722 and bug#70815 have some
>> information about this mess, as it happens on different systems.  Are
>> you sure this change is not specific to what you see on macOS, for
>> example?  We could make the default value different on different
>> systems, if we really need that, but as a single value, I think
>> "python" is better, as it covers many more use cases (including
>> Python 2.x, which you seem to exclude entirely).

I disagree with that default, for the reason I will explain after a
short rant.

> If I may provide a data point: on Debian Python 2 was removed completely
> since Debian 11 Bullseye[1], and the default interpreter for Python 3 is
> named "python3".  During the transition period of retiring Python 2
> (which the PSF stopped supporting since 2020), it is decided that
> "python" should always refer to Python 2 and "python3" is used for
> version 3 obviously so that the 2 Python versions can coexist and apps
> and libs can test against both versions at the same time.  Now that the
> transition has done long ago, Python 3 is the default on Debian systems
> and now only "python3" command is available.  There does exist a package
> "python-is-python3"[2] that provides a symlink from "python" to
> "python3", but it is not installed by default so should not be relied on
> directly.

What a horrible design.  Anyway, I now understand why Emacs has that
roundabout default value.

> On some other distribution (like Fedora) both "python" and "python3" are
> available[3].  Though AIUI, in Python 3 only era, "python3" is
> guaranteed to be available in most cases while "python" is not.  (I am
> curious about which system you are using?)

This is the sensible way to proceed: python is linked to the default
Python version (/usr/bin/python3.12 in a recent release), as is python3.
Other Python versions can be easily installed in parallel as python3.X
or python2.X.  Finally, if you create a "virtual environment" with
pythonX.Y, then in that venv the python command refers to pythonX.Y.

And this last bit is the important part: if the user (via venvs or
whatever other means) symlinked python to some program, whatever it is,
then Emacs should respect that decision.

Therefore (assuming we keep the workaround for Debian) the default value
should be:

  (defcustom python-interpreter
    (cond ((executable-find "python") "python")
          ((executable-find "python3") "python3")
          (t "python"))

> So TL;DR, on some distribution (e.g. Debian) only "python3" command is
> guaranteed to be available by default.

(My distro has symlinked commands node -> node-20, perl -> perl5.38.2
and many similar ones.  So Debian doesn't have any unversioned commands
like that?  Does any shebang from third parties work at all?)



reply via email to

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