Summary: | app-office/unoconv-0.3 (New Package) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Dan Fego <dan.fego> |
Component: | New packages | Assignee: | Gentoo Office Team <office> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | christoph.safferling, denilsonsa, gregoire.favre, rktspm, shawlz, sunrise, walter.dacol, zioalex |
Priority: | High | Keywords: | EBUILD, InOverlay |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | [sunrise-overlay] | ||
Package list: | Runtime testing required: | --- | |
Attachments: |
unoconv-0.3.ebuild
uconv-0.3-r1.ebuild using included patch to work with ooo3 on gentoo Ebuild for unoconv-0.4 plus python 2.7 fix Fix for KeyError Exception with python 2.7 New ebuild incorporating a new patch to work with libreoffice Add support for libreoffice, needs unoconv-0.4-r3.ebuild ebuild for unoconv git updated timeout patch |
Description
Dan Fego
2009-03-11 07:19:32 UTC
Created attachment 184654 [details]
unoconv-0.3.ebuild
I was perhaps a bit quick to submit this, as the program compiles, but it doesn't work for me. I assumed it would be alright since other people on Gentoo are obviously using it. My bad. Hi Dan, thanks for the ebuild. With OOo3 the unoconv source must be changed so you need to specify the URE_BOOTSTRAP at the top of unoconv after "import getopt, sys, os, glob, time" os.putenv('URE_BOOTSTRAP','vnd.sun.star.pathname:/usr/lib/openoffice/program/fun damentalrc') And change the extrapaths: extrapaths = glob.glob('/usr/lib*/openoffice*/program/') + glob.glob('/usr/lib*/ooo*/program') + glob.glob('/usr/lib/openoffice*/basis*/program') + [ '/Applications/NeoOffice.app/Contents/program', ] A detailed explanation here http://mpd.homeip.net/?p=250 I've contacted the maintainer to ask him to do that mods. $ unoconv -f pdf word07.doc /usr/lib/openoffice/basis3.0/program/uno.py:33: RuntimeWarning: Python C API version mismatch for module pyuno: This Python has API version 1013, module pyuno has version 1012. import pyuno Traceback (most recent call last): File "/home/vov/bin/exe/unoconv", line 564, in <module> main() File "/home/vov/bin/exe/unoconv", line 540, in main convertor = Convertor() File "/home/vov/bin/exe/unoconv", line 371, in __init__ error(2, "Existing listener not found.\n%s" % e) File "/usr/lib/openoffice/basis3.0/program/uno.py", line 329, in _uno_struct__repr__ return repr(self.__dict__["value"]) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-23: ordinal not in range(128) $ unoconv -f pdf word07.doc /usr/lib/openoffice/basis3.0/program/uno.py:33: RuntimeWarning: Python C API version mismatch for module pyuno: This Python has API version 1013, module pyuno has version 1012. import pyuno Traceback (most recent call last): File "/home/vov/bin/exe/unoconv", line 564, in <module> main() File "/home/vov/bin/exe/unoconv", line 540, in main convertor = Convertor() File "/home/vov/bin/exe/unoconv", line 371, in __init__ error(2, "Existing listener not found.\n%s" % e) File "/usr/lib/openoffice/basis3.0/program/uno.py", line 329, in _uno_struct__repr__ return repr(self.__dict__["value"]) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-23: ordinal not in range(128) Created attachment 213294 [details]
uconv-0.3-r1.ebuild using included patch to work with ooo3 on gentoo
The ebuild uses EAPI 2 and applies a patch doing the changes to the unoconv source described by Alessandro Surace. With those unoconv works like a charm on my x86 computer, tested with html, Microsoft Word and Microsoft Excel files, all converted to pdf.
Hm, doesn't work here. Anything I'm doing wrong? I used the 0.3-r1 tarball. $ unoconv -f pdf 01-intro.rtf Traceback (most recent call last): File "/usr/bin/unoconv", line 30, in <module> import uno, unohelper File "/usr/lib/openoffice/basis3.2/program/uno.py", line 33, in <module> import pyuno SystemError: dynamic module not initialized properly I also got the SystemError: dynamic module not initialized properly. I wonder if that's supposed to work with app-office/openoffice-bin-3.2.1 for amd64 or if I should compil it myself (just for reading email that %*ç%* people write using docx would be a shame). (In reply to comment #8) > I also got the SystemError: dynamic module not initialized properly. > I wonder if that's supposed to work with app-office/openoffice-bin-3.2.1 for > amd64 or if I should compil it myself (just for reading email that %*ç%* > people write using docx would be a shame). > I tested with both on amd64. app-office/unoconv-0.3-r2 (from graaff overlay) works properly with app-office/openoffice-3.2.1 on amd64 and refuses to work with app-office/openoffice-bin-3.2.0. So in some way it depends on openoffice-3.2.1 (not the binary) or the paths have to be fixed for it to work with openoffice-bin. Sample messages # On a different terminal, I run quickpkg openoffice and emerge --unmerge openoffice 09:26:42 jerome e/ unoconv -f pdf chapter2.docx unoconv: Cannot find the pyuno.so library in sys.path and known paths. Please locate this library and send your feedback to <tools@lists.rpmforge.net>. # On another terminal, emerge openoffice-bin 09:26:48 jerome e/ unoconv -f pdf chapter2.docx Traceback (most recent call last): File "/usr/bin/unoconv", line 24, in <module> import uno, unohelper File "/usr/lib/openoffice/basis-link/program/uno.py", line 33, in <module> import pyuno SystemError: dynamic module not initialized properly # On another terminal, emerge --usepkgonly openoffice 09:33:06 jerome e/ unoconv -f pdf chapter2.docx 09:38:00 jerome e/ # It works! (In reply to comment #7) > SystemError: dynamic module not initialized properly I got this here too. The reason is that the (pre-)compiled module installed within OOo is not compatible with our currently installed Python version. There is a very quick and simple solution, though: change the shebang to point to the OOo's own python. Before: #!/usr/bin/python After: #!/usr/lib64/openoffice/program/python I had to do only two changes in order to get unoconv working here. The first one was the shebang, as I just described. The second one was basically the same as the proposed patch above. The difference is that I've removed redundant paths that don't exist here. Here is my line: extrapaths = glob.glob('/usr/lib64/openoffice/basis*/program/') With these two changes, unoconv appears to work correctly. Nicely done, with this one lign change (python path) the svn works out of the box for me : thank you very much !!! Index: unoconv =================================================================== --- unoconv (revision 9075) +++ unoconv (working copy) @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/lib64/openoffice/program/python ### This program is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by (In reply to comment #11) > Nicely done, with this one lign change (python path) the svn works out of the > box for me : thank you very much !!! Actually... Things are a bit more complicated... openoffice-bin users must use this hashbang: /usr/lib/openoffice/program/python (since /usr/lib is a symlink to /usr/lib64, I think it's better to use just "lib", as it will work for 32-bit users too) But openoffice (compiled from source) doesn't install python there. I bet it uses system's own Python. That means the default hashbang will work, while the above one (for -bin users) will fail. How to solve this? Good question. Hi, I've writed a new ebuild (0.3-r3) (it's on sunrise-overlay) using a wrapper to fix openoffice source/bin question. see http://bugs.gentoo.org/345405 Can someone make an updated ebuild with libreoffice support? There is a new Version 0.4 for app-office/unoconv-0.4 http://dag.wieers.com/home-made/unoconv/ Please add this to Overlay Sunrise or to Portage, please. Created attachment 273707 [details] Ebuild for unoconv-0.4 plus python 2.7 fix Hi everybody, I have an ebuild for unoconv-0.4 in my overlay at http://git.overlays.gentoo.org/gitweb/?p=user/seden.git (available via layman) Here it is, the said fix for python 2.7 (Throws KeyError if LD_LIBRARY_PATH is empty) follows. Created attachment 273711 [details, diff]
Fix for KeyError Exception with python 2.7
Patch to add a wrapper that takes care of LD_LIBRARY_PATH if that is empty. On Python 2.7 a KeyError exception is thrown without the patch
Forgot to mention two points: a) I have sent the patch to Dag Wiiers and b) Tomorrow I'll write a live ebuild, because I need unoconv at work Cheers Created attachment 273933 [details]
New ebuild incorporating a new patch to work with libreoffice
The patch will follow next, the live ebuild will follow next week.
tested with liberoffice-3.3.2
Created attachment 273935 [details, diff]
Add support for libreoffice, needs unoconv-0.4-r3.ebuild
Said patch. I'll report it upstream as well.
Should that be working with libreoffice-bin-3.3.2 ? I just emerged unoconv from seden's overlay but can't convert anything with unoconv. (I don't have python 2.6 on my computer if that matter) Created attachment 281721 [details]
ebuild for unoconv git
An ebuild for the git version which contains 35a53d57cd (libreoffice support)
Created attachment 281723 [details]
updated timeout patch
I blindly updated the patch about the timeout but it probably needs
a deeper analyse/discussion.
*** Bug 345405 has been marked as a duplicate of this bug. *** We will take it, I will package it during next week. Added to main tree. Thanks for the patch. I installed app-office/unoconv-20110923 and it still doesn't work with app-office/libreoffice-bin-3.4.2-r2. It gives me this error message: unoconv: Cannot find the soffice binary in sys.path and known paths. ERROR: Please locate this binary and send your feedback to: <tools@lists.rpmforge.net>. In my machine, 'soffice.bin' is inside '/usr/lib64/libreoffice/program/'. Looking at the code in /usr/bin/unoconv I couldn't find any reference to this path. Instead, it has a reference to '/opt/libreoffice/program'. I tried to add the path '/usr/lib64/libreoffice/program/' to extrapaths, like this: extrapaths = glob.glob('/usr/lib*/libreoffice*/basis*/program') + \ glob.glob('/opt/libreoffice/program') + \ glob.glob('/usr/lib*/libreoffice/program') + \ glob.glob('/usr/lib*/openoffice*/program') + \ glob.glob('/usr/lib*/openoffice*/basis*/program') + \ glob.glob('/usr/lib*/ooo*/program') + \ glob.glob('/usr/lib*/ooo*/basis*/program') + \ glob.glob('/usr/local/openoffice*/program') + \ glob.glob('/usr/local/openoffice*/basis*/program') + \ glob.glob('/usr/local/ooo*/program') + \ glob.glob('/usr/local/ooo*/basis*/program') + \ glob.glob('/opt/openoffice*/program') + \ glob.glob('/opt/openoffice*/basis*/program') + \ glob.glob('/Applications/OpenOffice.org.app/Contents/program') + \ glob.glob('/Applications/OpenOffice.org.app/Contents/basis-link/program') + \ glob.glob('/Applications/NeoOffice.app/Contents/program') + \ glob.glob('/Applications/NeoOffice.app/Contents/basis-link/program') + \ glob.glob('/usr/bin') + \ glob.glob('/usr/local/bin') + \ glob.glob('/opt/bin') But then I get the following error: raceback (most recent call last): File "/usr/bin/unoconv", line 814, in <module> main() File "/usr/bin/unoconv", line 790, in main convertor = Convertor() File "/usr/bin/unoconv", line 519, in __init__ info(3, "Existing listener not found.\n%s" % e) File "/usr/lib/libreoffice/basis3.4/program/uno.py", line 323, in _uno_struct__repr__ return repr(self.__dict__["value"]) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-25: ordinal not in range(128) Then I remenbered that libreoffice-bin has a bundled copy of python. Then I changed the shebang in '/usr/bin/unoconv' to: #!/usr/lib64/libreoffice/program/python And now unoconv works for me. (In reply to comment #27) > I installed app-office/unoconv-20110923 and it still doesn't work with > app-office/libreoffice-bin-3.4.2-r2. It gives me this error message: > unoconv: Cannot find the soffice binary in sys.path and known paths. > ERROR: Please locate this binary and send your feedback to: > <tools@lists.rpmforge.net>. > > In my machine, 'soffice.bin' is inside '/usr/lib64/libreoffice/program/'. > Looking at the code in /usr/bin/unoconv I couldn't find any reference to this > path. Instead, it has a reference to '/opt/libreoffice/program'. > > I tried to add the path '/usr/lib64/libreoffice/program/' to extrapaths, like > this: > > > extrapaths = glob.glob('/usr/lib*/libreoffice*/basis*/program') + \ > glob.glob('/opt/libreoffice/program') + \ > glob.glob('/usr/lib*/libreoffice/program') + \ > glob.glob('/usr/lib*/openoffice*/program') + \ > glob.glob('/usr/lib*/openoffice*/basis*/program') + \ > glob.glob('/usr/lib*/ooo*/program') + \ > glob.glob('/usr/lib*/ooo*/basis*/program') + \ > glob.glob('/usr/local/openoffice*/program') + \ > glob.glob('/usr/local/openoffice*/basis*/program') + \ > glob.glob('/usr/local/ooo*/program') + \ > glob.glob('/usr/local/ooo*/basis*/program') + \ > glob.glob('/opt/openoffice*/program') + \ > glob.glob('/opt/openoffice*/basis*/program') + \ > glob.glob('/Applications/OpenOffice.org.app/Contents/program') + \ > > glob.glob('/Applications/OpenOffice.org.app/Contents/basis-link/program') + \ > glob.glob('/Applications/NeoOffice.app/Contents/program') + \ > > glob.glob('/Applications/NeoOffice.app/Contents/basis-link/program') + \ > glob.glob('/usr/bin') + \ > glob.glob('/usr/local/bin') + \ > glob.glob('/opt/bin') > > > But then I get the following error: > > raceback (most recent call last): > File "/usr/bin/unoconv", line 814, in <module> > main() > File "/usr/bin/unoconv", line 790, in main > convertor = Convertor() > File "/usr/bin/unoconv", line 519, in __init__ > info(3, "Existing listener not found.\n%s" % e) > File "/usr/lib/libreoffice/basis3.4/program/uno.py", line 323, in > _uno_struct__repr__ > return repr(self.__dict__["value"]) > UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-25: > ordinal not in range(128) > > Then I remenbered that libreoffice-bin has a bundled copy of python. Then I > changed the shebang in '/usr/bin/unoconv' to: > > #!/usr/lib64/libreoffice/program/python > > And now unoconv works for me. YOu need to open a new bug for that plz |