Patches for Python scripts

Enrico Forestieri forenr at lyx.org
Sun Jan 31 11:39:15 UTC 2021


On Sun, Jan 31, 2021 at 04:22:39AM +0100, Thibaut Cuvelier wrote:
> On Sat, 30 Jan 2021 at 12:26, Enrico Forestieri <forenr at lyx.org> wrote:
> > On Sat, Jan 30, 2021 at 05:31:05AM +0100, Thibaut Cuvelier wrote:
> > > On Sat, 30 Jan 2021 at 02:31, Enrico Forestieri <forenr at lyx.org> wrote:
> > > >
> > > > So, it seems that you have to check also for the 32-bit version.
> > > >
> > > Indeed. Would the attached patch solve the problem? I first look for a
> > > 64-bit version before a 32-bit, just to favour newer things, but there is
> > > no other reason to do so.
> >
> > The patch does not apply neither to current master nor to current stable
> > (most probably it depends on previous patches):
> >
> > $ patch --dry-run -p1 <
> > 0013-Configure-look-for-Java-in-the-registry-on-Windows.patch
> > checking file lib/configure.py
> > Hunk #1 FAILED at 330.
> > Hunk #2 succeeded at 403 (offset -14 lines).
> > Hunk #3 succeeded at 1923 (offset -94 lines).
> > 1 out of 3 hunks FAILED
> >
> > and I had to apply it manually. Before applying it, I took away java from
> > PATH and reconfigured:
> >
> > ...
> > checking for a java interpreter...
> > +checking for "java"...  no
> > ...
> >
> > Correctly, java was not found (it is found when it is in PATH).
> > Then I applied the patch an reconfigured again:
> >
> > ...
> > checking for a java interpreter...
> > +checking for "java"...  no
> > Traceback (most recent call last):
> >   File "C:\cygwin\win\python\lib\logging\__init__.py", line 870, in emit
> >     stream.write(ufs % msg)
> > LookupError: unknown encoding: cp65001
> > Logged from file configure.py, line 346
> > ...
> >
> > I have a native Windows version of Python 2.7 installed in
> > "C:\cygwin\win\python".
> >
> > So, it seems there is a problem with Python 2
> >
> 
> I just tried with Python 2.7.18 (64 bits), I cannot reproduce your problem.
> What is exactly on your line 346? I guess it is something like logger.info,
> a line that runs without problem on my side (Python 3.8 and 2.7).

Yes, that's exactly "logger.info('+checking for java: ' + java_bin)".
It seems a problem related to the locale. I was reconfiguring from a
cygwin shell, whose locale is UTF-8, apparently something alien to
Windows. I now tried reconfiguring from a cmd.exe window and the result is:

...
checking for a java interpreter...
+checking for "java"...  no
+checking for java: C:\Program Files (x86)\Java\jre1.8.0_281\bin\java.exe
...

So, it works. However, to avoid confusion, you should avoid logging the
first negative result. Or, maybe, on Windows report something like this:

...
checking for a java interpreter...
+checking for "java" in PATH...  no
+checking for "java" in registry... C:\Program Files (x86)\Java\jre1.8.0_281\bin\java.exe
...

And, yes, I know making things work for everyone is exhausting...

Thank you for your efforts.

-- 
Enrico


More information about the lyx-devel mailing list