lightproof and python3.3 (was: Re: [Grammar checking] Using LanguageTool lexicons with Lightproof) new possible

Rene Engelhard rene at debian.org
Tue Jan 15 04:09:54 PST 2013


On Wed, Dec 19, 2012 at 11:47:23PM +0100, Rene Engelhard wrote:
> On Wed, Dec 19, 2012 at 10:39:16AM +0100, Németh László wrote:
> >    Indeed, this is a more general problem with the bundled spelling
> >    dictionaries:
> > 
> >    [1]https://bugs.freedesktop.org/show_bug.cgi?id=58503 (Options->Writing
> >    Aids doesn't list the available bundled language modules)
> 
> Yes, looks like it..

Actually, it also looks like that lightproof itself[1] (NOT
the version inside LO) misses python3 fixes. e.g.
http://cgit.freedesktop.org/libreoffice/dictionaries/commit/?id=8be323a6b7496003419e2587bc4573949fe142dc).

Indeed. after fixing the "from string import join" issue there
it's at least not "unknown" anymore, but I fail to fix the rest as I
don't see what changed and how to adapt in standalone lightproof which
builds the whole stuff together dynamically.
(and python-uno built against python 2.7 works.)

My corrent version without the dict/abbrev changes (which I still
need to fiddle with, looks like cgit/git mangles the unicode, and I
don't see what changed in dict= anyway, abbrev was just a removed u, no?

--- snip ---
imported from http://cgit.freedesktop.org/libreoffice/dictionaries/commit/?id=8be323a6b7496003419e2587bc4573949fe142dc

--- lightproof-1.5+git20121204.orig/pythonpath/lightproof_impl___implname__.py
+++ lightproof-1.5+git20121204/pythonpath/lightproof_impl___implname__.py
@@ -1,6 +1,5 @@
 # -*- encoding: UTF-8 -*-
 import uno, re, sys, os, traceback
-from string import join
 from com.sun.star.text.TextMarkupType import PROOFREADING
 from com.sun.star.beans import PropertyValue

@@ -121,7 +120,7 @@ def suggest(rLoc, word):
         if not x:
             return word
         t = x.getAlternatives()
-        suggestions[word] = join(t, "|")
+        suggestions[word] = "|".join(t)
     return suggestions[word]

 # get the nth word of the input string or None
--- lightproof-1.5+git20121204.orig/src/en/en.dat
+++ lightproof-1.5+git20121204/src/en/en.dat
@@ -379,5 +379,5 @@ def measurement(mnum, min, mout, mstr, d
     m = calc("CONVERT_ADD", (float(eval(mnum.replace(remove, "").replace(decimal, ".").replace(u"−", "-"))), min, mout))
     a = list(set([str(calc("ROUND", (m, 0)))[:-2], str(calc("ROUND", (m, 1))), str(calc("ROUND", (m, 2))), str(m)])) # remove duplicated rounded items
     a.sort(lambda x, y: len(x) - len(y)) # sort by string length
-    return join(a, mstr + "\n").replace(".", decimal).replace("-", u"−") + mstr
+    return (mstr + "\n").join(a).replace(".", decimal).replace("-", u"−") + mstr

--- lightproof-1.5+git20121204.orig/src/hu_HU/hu_HU.dat
+++ lightproof-1.5+git20121204/src/hu_HU/hu_HU.dat
@@ -911,4 +911,4 @@ def measurement(mnum, min, mout, mstr):
     m = calc("CONVERT_ADD", (float(mnum.replace(",", ".").replace(u"−", "-")), min, mout))
     a = list(set([str(calc("ROUND", (m, 0)))[:-2], str(calc("ROUND", (m, 1))), str(calc("ROUND", (m, 2))), str(m)])) # remove duplicated rounded items
     a.sort(lambda x, y: len(x) - len(y)) # sort by string length
-    return join(a, mstr + "|").replace(".", ",").replace("-", u"−") + mstr
+    return (mstr + "|").join(a).replace(".", ",").replace("-", u"−") + mstr
--- lightproof-1.5+git20121204.orig/pythonpath/lightproof___implname__.py
+++ lightproof-1.5+git20121204/pythonpath/lightproof___implname__.py
@@ -1,3 +1,4 @@
 # -*- encoding: UTF-8 -*-
+from __future__ import unicode_literals
 dic = ${data}

--- lightproof-1.5+git20121204.orig/pythonpath/lightproof_impl___implname__.py
+++ lightproof-1.5+git20121204/pythonpath/lightproof_impl___implname__.py
@@ -1,4 +1,5 @@
 # -*- encoding: UTF-8 -*-
+from __future__ import unicode_literals
 import uno, re, sys, os, traceback
 from com.sun.star.text.TextMarkupType import PROOFREADING
 from com.sun.star.beans import PropertyValue

--- snip ---

Regards,
 
Rene

[1] http://cgit.freedesktop.org/libreoffice/lightproof


More information about the LibreOffice mailing list