Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2022-01-05 Thread Enrico Forestieri
On Wed, Jan 05, 2022 at 12:27:25PM +, José Abílio Matos wrote:
> 
> On Tuesday, 4 January 2022 08.53.46 WET Enrico Forestieri wrote:
> > I disagree. It should return the first usable version found first in
> > PATH. The user has to be in control of what version has to be run, not
> > the software.
> 
> I understand what you say, and I agree, but that is precisely what we are 
> doing now. We are choosing the python path based on some criteria 
> automatically.

What I mean is that, currently, you can adjust the PATH and make LyX
choose the version you want that meets those criteria (python 3).
If you have python 3.6 and python 3.9 but, for some reason, you want to
use python 3.6, you can do that. On the contrary, if you force using
python 3.9, the user has no control. For example, the user may have the
python-pygmemts package installed for python 3.6 but not for python 3.9.

> What I would like to have would be a way to configure this. Probably even if 
> you do not expose this in the graphical interface, only on the preferences 
> file.
> 
> What do you think?

I think that this is precisely what you can do now. Put a link to the
python version you want to use earlier in the PATH and that's it.

-- 
Enrico
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2022-01-05 Thread José Abílio Matos
On Tuesday, 4 January 2022 08.53.46 WET Enrico Forestieri wrote:
> I disagree. It should return the first usable version found first in
> PATH. The user has to be in control of what version has to be run, not
> the software.

I understand what you say, and I agree, but that is precisely what we are 
doing now. We are choosing the python path based on some criteria 
automatically.

What I would like to have would be a way to configure this. Probably even if 
you do not expose this in the graphical interface, only on the preferences 
file.

What do you think?

-- 
José Abílio-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2022-01-04 Thread Enrico Forestieri
On Tue, Jan 04, 2022 at 08:27:10AM +, José Abílio Matos wrote:
> 
> The code can be made more complete.
> E.g. previously we searched for python3* and python2* eventually I think that 
> we can go back to something related. Instead of returning the first python 
> that satisfies the requirement (minimum version) it should return the most 
> recent version available (the best).

I disagree. It should return the first usable version found first in
PATH. The user has to be in control of what version has to be run, not
the software.

-- 
Enrico
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2022-01-04 Thread José Abílio Matos
On Tuesday, 4 January 2022 07.16.52 WET Stephan Witt wrote:
> Interestingly on my system the python3 is detected only if I install the
> Python package from python.org. The python3 in /usr/bin is not tried?
> Sorry, I didn’t read the code yet.

It should according to the code in support/os.cpp.

The logic is simple and follows some guidelines from python.org.
For posix systems it first tries to see if "python3" can be found. If not try 
to run "python2" and if that does not work then returns "python".

What do you see in Help -> About LyX?

In my case I see "Python detected: python3 -tt".


The code can be made more complete.
E.g. previously we searched for python3* and python2* eventually I think that 
we can go back to something related. Instead of returning the first python 
that satisfies the requirement (minimum version) it should return the most 
recent version available (the best).

My use case is e.g. Red Hat Enterprise Linux (and related). /usr/bin/python3 
will point to the system python yet there could be available other more recent 
versions.

This is similar to the compiler available, e.g. the default compiler in RHEL 7 
default compiler is 4.7.x that is unable to compile LyX. Yet using devtools it 
is possible to install gcc-9 and that is more than capable to compile LyX.

The same applies to the python versions available there. The minimum python 
version that we support is python 3.5 released more than 6 years ago that it 
has no longer any security fixes for more than 1 year.

> > Probably the case you want to can be best done through documentation, no?
> 
> Yes, at first this is the best option probably.
> 
> My question for the future is how to act on next move of Apple. Neither I
> know when it will happen nor I know what happens. They announced to remove
> the preinstalled python altogether. ATM they provide python3 as wrapper.
> It’s asking the user to download and install the Command Line Developer
> Tools from Apple instead of doing anything useful. The exit status is 1.
> 
> Currently LyX is using python (python2) and the warning info pops up once:
> „LyX needs to be updated“. Obviously this is wrong now. Python3 needs to be
> installed instead.
> 
> So I’ll have to investigate further.
> 
> Stephan

Thank you. :-)
-- 
José Abílio-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2022-01-03 Thread Stephan Witt
Am 04.01.2022 um 01:37 schrieb José Abílio Matos :
> 
> On Friday, 31 December 2021 13.03.57 WET Stephan Witt wrote:
> > I’m curious how difficult it would be to ignore python2 and present a
> > message box for users to tell them how to get a python3 interpreter.
> >
> > BR, Stephan
> 
> For now we always search for Python 3 before Python 2. We know what is the 
> version that we are using. So that warn can be done, but then we probably 
> only want to show it once, or at least have an option to turn it off.

Interestingly on my system the python3 is detected only if I install the Python 
package from python.org. The python3 in /usr/bin is not tried? Sorry, I didn’t 
read the code yet.

> Probably the case you want to can be best done through documentation, no?

Yes, at first this is the best option probably.

My question for the future is how to act on next move of Apple. Neither I know 
when it will happen nor I know what happens. They announced to remove the 
preinstalled python altogether. ATM they provide python3 as wrapper. It’s 
asking the user to download and install the Command Line Developer Tools from 
Apple instead of doing anything useful. The exit status is 1. 

Currently LyX is using python (python2) and the warning info pops up once: „LyX 
needs to be updated“. Obviously this is wrong now. Python3 needs to be 
installed instead.

So I’ll have to investigate further.

Stephan
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2022-01-03 Thread José Abílio Matos
On Friday, 31 December 2021 13.03.57 WET Stephan Witt wrote:
> I’m curious how difficult it would be to ignore python2 and present a
> message box for users to tell them how to get a python3 interpreter.
> 
> BR, Stephan

For now we always search for Python 3 before Python 2. We know what is the 
version that we are using. So that warn can be done, but then we probably only 
want to show it once, or at least have an option to turn it off.

Probably the case you want to can be best done through documentation, no?

-- 
José Abílio-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2022-01-03 Thread José Abílio Matos
On Wednesday, 29 December 2021 10.38.38 WET Stephan Witt wrote:
> In any case we should ensure the detected usable python is used
> consequently.
> 
> Stephan

This should be done now.

All the heuristics regarding Python detection is now placed in src/support/
os.cpp. In particular we can try use Python 3 by default and only use Python 2 
as a last resort.

Please test this to see if this works as intended.
-- 
José Abílio-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2021-12-31 Thread Stephan Witt
Am 29.12.2021 um 11:38 schrieb Stephan Witt :
> 
> Am 28.12.2021 um 13:55 schrieb José Abílio Matos :
>> 
>> On Tuesday, 28 December 2021 12.33.57 WET Stephan Witt wrote:
>>> The LyX tasks here are IMO:
>>> 1. Assure the detected python3 is used consequently. This is not the case
>>> ATM.
>>> 2. Document the meaning of the prompts the LyX user is seeing on
>>> Monterey.
>>> 3. Provide a working python3 or give appropriate feedback on
>>> first start about users option to install python3.
>>> 
>>> AFAIK, José Abílio is working on a solution for 1. I’m able to help with the
>>> Mac part of the problem.
>> 
>> I am not working on 1, the issue that I am working is a bit different, 
>> although related.
> 
> I referred to your proposal to consequently use the detected python version 
> in our scripts.
> 
> ATM on Mac with python3 installed there are hardcoded calls of python e.g. in 
> configure.py
> or - as you’ve pointed out - in the generated converter calls triggering the 
> warning
> „LyX“ needs to be updated we want to avoid.

With latest changes to configure.py LyX is using python3 exclusively on first 
configuration run.
(as of commit 77670bc9983392e32abb1cec236e5741b4d8c84b)

Now I have two options to get the rest of python2 calls eliminated:
1. the replacement of the hard coded „python“ RC configuration entries with 
$${python} (your proposal) or
2. the drop-in of a python wrapper script for the Mac package. This script may 
check for python3
and start this instead of the system python (which is python2 and should be 
avoided).

The implementation of option 1 makes option 2 superfluous and is better. So 
I’ll see how you proceed.

BTW, did you ever check how LyX behaves on a system w/o any python interpreter 
installed?

I’m curious how difficult it would be to ignore python2 and present a message 
box for users to tell them how to get a python3 interpreter.

BR, Stephan
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2021-12-29 Thread Stephan Witt
Am 28.12.2021 um 13:55 schrieb José Abílio Matos :
> 
> On Tuesday, 28 December 2021 12.33.57 WET Stephan Witt wrote:
> > The LyX tasks here are IMO:
> > 1. Assure the detected python3 is used consequently. This is not the case
> > ATM.
> > 2. Document the meaning of the prompts the LyX user is seeing on
> > Monterey.
> > 3. Provide a working python3 or give appropriate feedback on
> > first start about users option to install python3.
> >
> > AFAIK, José Abílio is working on a solution for 1. I’m able to help with the
> > Mac part of the problem.
> 
> I am not working on 1, the issue that I am working is a bit different, 
> although related.

I referred to your proposal to consequently use the detected python version in 
our scripts.

ATM on Mac with python3 installed there are hardcoded calls of python e.g. in 
configure.py
or - as you’ve pointed out - in the generated converter calls triggering the 
warning
„LyX“ needs to be updated we want to avoid.

> In the case of mac we can
> What I suggest is to use by default the latest python version available in 
> the system.

That’s part of the problem. „Virgin“ systems have python 2 only.

> As it is now we search for a python version and stick with it.
> What I propose is to test the different versions available and pick the 
> latest.
> 
> Python 3 has been tested extensively and so it is ready to be the default 
> option.

Yes, I agree.

> > Regarding the point 3 - Apples recommendation to bundle python with LyX
> > (49764202) - I’m not sure if this is a real option. The Windows package
> > contains python, IMO. So it is possible. But is it clever? I don’t like the
> > solution to point the user to homebrew or macports to install python. Too
> > much terminal work, IMO.
> >
> > What do others think about the situation?
> 
> How do you deal with the latex installation in mac?

LyX starts fine w/o it and the user has to install some TeX distribution to use 
it.
There is a recommended one: MacTeX - having a installable disc image for 
download on it’s
web site. This is easy to use.

For Python the situation is a little bit different. The macOS „blames“ LyX at 
the first
configure run if the user didn’t install a recent python 3 already. Either we 
live with it
and document this near the download link at lyx.org or we try to inform the 
user at LyX
startup and give the opportunity to download and install python 3 and refuse to 
run configure
with the system python. This solves the problem we run into if Apple removes 
python altogether.

The homebrew or macports packages are the other option for experienced users. 
Some of them
have an installation on the system already. So we should detect it and be fine 
with it too.

In any case we should ensure the detected usable python is used consequently.

Stephan
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [RFC] Python related system prompt "Lyx must be updated" on macOS

2021-12-28 Thread José Abílio Matos
On Tuesday, 28 December 2021 12.33.57 WET Stephan Witt wrote:
> The LyX tasks here are IMO:
> 1. Assure the detected python3 is used consequently. This is not the case
> ATM.
> 2. Document the meaning of the prompts the LyX user is seeing on
> Monterey.
> 3. Provide a working python3 or give appropriate feedback on
> first start about users option to install python3.
> 
> AFAIK, José Abílio is working on a solution for 1. I’m able to help with the
> Mac part of the problem.

I am not working on 1, the issue that I am working is a bit different, 
although related.

In the case of mac we can 
What I suggest is to use by default the latest python version available in the 
system.

As it is now we search for a python version and stick with it.
What I propose is to test the different versions available and pick the 
latest.

Python 3 has been tested extensively and so it is ready to be the default 
option.

> Regarding the point 3 - Apples recommendation to bundle python with LyX
> (49764202) - I’m not sure if this is a real option. The Windows package
> contains python, IMO. So it is possible. But is it clever? I don’t like the
> solution to point the user to homebrew or macports to install python. Too
> much terminal work, IMO.
> 
> What do others think about the situation?

How do you deal with the latex installation in mac?

> BR, Stephan


-- 
José Abílio-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel