On Tue, Sep 08, 2026 at 10:44:04PM +0100, José Matos wrote:
> 1. Please take the chance and remove the comment:
> // Check whether this is a python 2 or 3 binary.
>
> This is no longer true since 2.5.x
I am happy to ditch, but I saw explicit checks on python 2 while
going through the code yesterday, eg in Graphicsconverter.
> 2. Another issue that can simplify a bit the code is to go from:
>
> const string info_script = "import sys; print('{}
> ({})'.format(sys.version.split()[0],sys.executable), end='')";
> to
>
> const string info_script = "import sys; print(f'{sys.version.split()[0]}
> ({sys.executable})', end='')";
Added. Please check the patch for your request. I prefer to commit separately
to keep API change and P2/P3 failures separate for bisects.
> Incidentally, as you know, the f prefix refers to a formatted string.
Do not underestimate me, as a python meh-thusiast I have no clue what f means :)
That said please carefully check the patch, your message has new line in the
snippet exactly in the spot where you could have '' or ' '. (' ' renders better
in About). Or you really meant \n?
Pavel
>From 7c69a1eb11af84253037eb8f2d123c74f544e7f1 Mon Sep 17 00:00:00 2001
From: Pavel Sanda <[email protected]>
Date: Wed, 9 Sep 2026 09:40:38 +0200
Subject: [PATCH 06/11] python 2->3 leftovers in os.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
LyX requires python 3 from 2.5.x.
Assisted-by: Jose :)
---
src/support/os.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/support/os.cpp b/src/support/os.cpp
index 9e2691eef3..8fee8afa98 100644
--- a/src/support/os.cpp
+++ b/src/support/os.cpp
@@ -66,10 +66,9 @@ static string const python_call(string const & binary, bool verbose = false)
if (verbose)
lyxerr << "Examining " << binary << "\n";
- // Check whether this is a python 2 or 3 binary. The candidate may be
- // a bare name ("python3"), a name plus argument ("py -3") or a quoted
- // absolute path found with walking-path fallback; split it into argv
- // so the probe never goes through a shell.
+ // The candidate may be a bare name ("python3"), a name plus argument
+ // ("py -3") or a quoted absolute path found with walking-path fallback;
+ // split it into argv so the probe never goes through a shell.
vector<string> argv = splitCommandTokens(binary);
if (argv.empty())
return string();
@@ -181,7 +180,7 @@ vector<string> pythonArgvForm()
// consumers: About dialog & GraphicsConverter version check on "2"
string const python_info()
{
- const string info_script = "import sys; print('{} ({})'.format(sys.version.split()[0],sys.executable), end='')";
+ const string info_script = "import sys; print(f'{sys.version.split()[0]} ({sys.executable})', end='')";
if (!hasPython())
return("None");
--
2.39.5
--
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel