From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.devel Subject: Re: master 7f0a252f216 1/2: Prefer python3 for python-interpreter Date: Fri, 27 Sep 2024 20:43:47 +0200 Message-ID: <87ed55ey3g.fsf@gmail.com> References: <86r0958t97.fsf@gnu.org> <874j618r3b.fsf@debian-hx90.lan> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20131"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , Stefan Kangas , emacs-devel@gnu.org To: Xiyue Deng Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 27 20:44:37 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1suFxE-00056H-Pe for ged-emacs-devel@m.gmane-mx.org; Fri, 27 Sep 2024 20:44:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suFwd-0001SW-Mv; Fri, 27 Sep 2024 14:43:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suFwa-0001Ew-SH for emacs-devel@gnu.org; Fri, 27 Sep 2024 14:43:56 -0400 Original-Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suFwY-0002Tj-CZ; Fri, 27 Sep 2024 14:43:55 -0400 Original-Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5c46680a71bso2709600a12.2; Fri, 27 Sep 2024 11:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727462632; x=1728067432; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=PExsjAHysBLoxNLGVnzsSAuUdTzvHSwhIzT/k+QRsxg=; b=IU982Lzk0AT53EqViI22rkD76Z2Igh4sh+qABde3+81YR+Xj+LErCTfl5ASvbAzMV+ pQrKBNGzCA1+wl7/10c30lTG20EZhgZoAStjQWpy6jl6Ufi2gIMmK/j95tNNBQlfizPs mPC2mjD1O5a/zhZYuEXgXbifAUpWv9s0/D6eAJW9RSAMi3JRf1O/Uh6OjpNwB6KzSIXO T1WfnPHpU38w25ChskWOvG2hQH3v0qQwXeHTwCoRSLP6lHzd+KRKED71tsJWb/KDDD9J vghVQ8z4jf8K/Qwcj7AqJsLV5dvrLEmpaJZmFHq/1BY+0OJpOTJtGbOK1xBvl6g3D4Nk 9LRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727462632; x=1728067432; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PExsjAHysBLoxNLGVnzsSAuUdTzvHSwhIzT/k+QRsxg=; b=pFvyuRe+spIYj1wszgOLWO2fS9rrgtUN8BYRm/o8Fq9M99ezooerbSM8X4u2WmtNWk ET+CBWy5jXjX3E7XMmn1nOzPmfVo2W2jZq3IyMHe6gPyIpPzy7TfS1X/jQz3P6USlBJF f+/xiyLkPkG78M/V7ECYMwZ7PNLNBprMe+0EqD7UiAgsV5B1mL1fRi3r2/a+klEiOlIq fWDLfN8TKhNQAv18drmKVLOZGA4BMvPsugv7OF3BeERDpSOX1yLutV6Fc5bLCne5+3W6 VraPdgXszcRcDM7IcmnGoTGzZE2uTOkuzHrIJViQCnE0mG+SBkaTS1l1uwBpW+Y1s2l3 9J+A== X-Forwarded-Encrypted: i=1; AJvYcCXsrxXdB1mHTmkmR7m/GmMVekHmUp0tBOgue5+3k/M88FBkjZ2ij1UaxebeW+Yw0EweocM/B0HFHQAw8Q==@gnu.org X-Gm-Message-State: AOJu0YyG7QDM52Iw4B9/bpXqEKYfO7VhyV50YOuR3HzjPyRKity295VI bPjir1Z5K4PenK/AoeA5RpTH8SXa3NVj5Xy5T86Ete0bTCreZH6CjruLZA== X-Google-Smtp-Source: AGHT+IEaetqRvVfYxz4CjawvU59D00SlSnmkhsZiiP8zxStE1X8qjrLPd4xD0Wfv7nuDYcvEGPIPVA== X-Received: by 2002:a17:907:6d1b:b0:a8d:64af:dc4c with SMTP id a640c23a62f3a-a93c4909952mr437090566b.25.1727462631352; Fri, 27 Sep 2024 11:43:51 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8a87:ff00::d6f6]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c70c4sm161836766b.65.2024.09.27.11.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 11:43:50 -0700 (PDT) In-Reply-To: <874j618r3b.fsf@debian-hx90.lan> (Xiyue Deng's message of "Fri, 27 Sep 2024 00:59:20 -0700") Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324145 Archived-At: On Fri, 27 Sep 2024 at 00:59, Xiyue Deng wrote: > Eli Zaretskii 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?)