configure.py assumes "python" command exists

Scott Kostyshak skostysh at lyx.org
Mon Feb 15 15:25:45 UTC 2021


On Mon, Feb 15, 2021 at 09:50:04AM -0500, Richard Kimberly Heck wrote:
> On 2/15/21 5:56 AM, José Abílio Matos wrote:
> >
> > On Monday, February 15, 2021 4:27:40 AM WET Richard Kimberly Heck wrote:
> >
> > > We have a Python detection routine, find_python_binary(), so it could be
> >
> > > modified to check for those commands explicitly. I'm reluctant to touch
> >
> > > that code myself though.
> >
> >
> > The detection code in LyX is working correctly, it works if the name
> > is not python. The code searches for python39 or python3.9 or ...
> >
> >
> > The issue that Scott is raising is different. The problem is that
> > configure.py always issue a "python" as the python name. When we get
> > here the lyx detection code already worked correctly.
> >
> >
> > I had thought previously about this and I have an idea to fix this.
> >
> >
> > """
> >
> > import os, sys
> >
> >
> > print(os.path.basename(sys.executable))
> >
> > """
> >
> >
> > so the idea is to replace "python" by os.path.basename(sys.executable)
> > in all the calls on configure.py.
> >
> >
> > This code is general, since it takes care of the directory separators,
> > and it should work everywhere.
> >
> >
> >
> > Funnily enough the function rescanTeXFiles (line 1920) already does
> > that. :-)
> >
> >
> > For the next stable release if we assume a minimum of python 3.6 we
> > can use the f-strings (formatted in case you wonder :-) ) and the code
> > could be simply.
> >
> >
> > python = os.path.basename(sys.executable);
> >
> > ...
> >
> >
> > print (f"{python}")
> >
> >
> > so that the content of variable python is replaced inside the function...
> >
> Well, José, you are the expert on this, so please go ahead. It probably
> would be good to have this for the next release (probably beta 1).

+1

Thanks for taking a look, José.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210215/1b64db14/attachment.asc>


More information about the lyx-devel mailing list