Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 379227 - app-office/libreoffice-3.4.2.3: pyuno broken
Summary: app-office/libreoffice-3.4.2.3: pyuno broken
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Office Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-15 04:11 UTC by Egor Y. Egorov
Modified: 2012-03-01 13:16 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
strace.out (strace.out,140.21 KB, text/plain)
2011-12-06 03:23 UTC, Egor Y. Egorov
Details
out.py (out.py,1.23 KB, text/plain)
2012-02-09 05:05 UTC, Egor Y. Egorov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Egor Y. Egorov 2011-08-15 04:11:15 UTC
pyuno broken in app-office/libreoffice-3.4.2.3. In 3.3.3 all right.

Reproducible: Always

Steps to Reproduce:
1. USE="odk java" emerge =libreoffice-3.4.2.3
2. create new file:
$ cat test.py
#!/usr/bin/env python                                                                                                                        
# -*- coding: utf-8 -*-                                                                                                                      
import sys                                                                                                                                   
sys.path.append('/usr/lib/libreoffice/basis-link/program')
import os
import uno

#a UNO struct later needed to create a document
from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
from com.sun.star.text.TextContentAnchorType import AS_CHARACTER
3. execute script:
$ python test.py
Actual Results:  
executing with errors:
Traceback (most recent call last):
  File "test.py", line 9, in <module>
    from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
  File "/usr/lib/libreoffice/basis-link/program/uno.py", line 291, in _uno_import
    raise ImportError( "type "+ name + "." +x + " is unknown" )
ImportError: type com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK is unknown



Expected Results:  
executing without errors

Found out similar problem:
https://bugs.archlinux.org/task/23733
https://bugs.freedesktop.org/show_bug.cgi?id=37037

On the basis of this was obtained a patch, which solves the problem:

--- /usr/lib/libreoffice/basis-link/program/uno.py_orig 2011-08-09 00:26:36.000000000 +0700                                                  
+++ /usr/lib/libreoffice/basis-link/program/uno.py      2011-08-15 10:41:26.000000000 +0700                                                  
@@ -25,7 +25,11 @@                                                                                                                           
 #
 #*************************************************************************
 import sys
+import os
 
+sys.path.append('/usr/lib/libreoffice/basis-link/program')
+if getattr(os.environ, 'URE_BOOTSTRAP', None) is None:
+    os.environ['URE_BOOTSTRAP'] = "vnd.sun.star.pathname:/usr/lib/libreoffice/program/fundamentalrc"
 import pyuno
 import __builtin__
 import socket # since on Windows sal3.dll no longer calls WSAStartup


Please, fix it.
Thanks.
Comment 1 Tomáš Chvátal (RETIRED) gentoo-dev 2011-08-15 13:44:52 UTC
It looks like it is broken even more as it is not multilib strict safe. :)

Anyway you should sent your patch to libreoffice@lists.freedesktop.org to get it accepted upstream. Until it is not accepted upstream we won't add it to main tree.
Comment 2 Egor Y. Egorov 2011-08-15 14:23:39 UTC
(In reply to comment #1)
> It looks like it is broken even more as it is not multilib strict safe. :)
> 

So replace /usr to ${exec_prefix}

Look https://bugs.archlinux.org/task/23733 please

I do not think I have the skills to talk to upstream. I can only say that in earlier versions uno.py contain these lines.
Comment 3 Egor Y. Egorov 2011-08-18 02:04:46 UTC
So, upstream said it Gentoo bug
https://bugs.freedesktop.org/show_bug.cgi?id=40168#c1
Comment 4 Egor Y. Egorov 2011-08-18 16:05:25 UTC
same on 3.4.3.1
Comment 5 Tomáš Chvátal (RETIRED) gentoo-dev 2011-08-22 09:39:38 UTC
So I tried to consolidate those patches:

http://dev.gentooexperimental.org/~scarabeus/libreo/0001-Try-to-make-pyuno-work-with-system-python.patch

Also sent upstream for review, when done i will add it to the portage so it gets applied automatically.

In meantime feel free to test it yourself :)
Comment 6 Egor Y. Egorov 2011-08-23 02:03:26 UTC
I tried to put this patch on 3.4.3.1
If this is done after ebuild ... unpack, geting errors


config.status: creating Makefile
config.status: creating bin/repo-list
config.status: error: cannot find input file: `pyuno/source/module/uno.py.in'

If this is done after ebuild ... prepare, macro does not run and uno.py contains the following lines


sys.path.append('@libdir@/@OOOINSTALLDIRNAME@/basis-link/program')
if getattr(os.environ, 'URE_BOOTSTRAP', None) is None:
    os.environ['URE_BOOTSTRAP'] = "vnd.sun.star.pathname:@libdir@/@OOOINSTALLDIRNAME@/program/fundamentalrc"
Comment 7 Mads 2011-08-24 19:32:51 UTC
(In reply to comment #6)

If you look at the patch, you can see it is a generated by git. I unfortunately do not know how to tell /usr/bin/patch to rename uno.py to uno.py.in like the patch file says (for all I know that might be a git-only feature), but the patch works if you just remember to do it manually after patching.

Compiling as we speak, hope it completes this time :)
Comment 8 Egor Y. Egorov 2011-10-11 08:17:12 UTC
Any news?
Comment 9 Matthias Liebig 2011-11-10 13:11:19 UTC
Patch is still needed for app-office/libreoffice-3.4.4. After patching it works fine for me on ~amd64.

# emerge -pv app-office/libreoffice

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] app-office/libreoffice-3.4.4.2-r1  USE="branding dbus gstreamer gtk java kde mysql opengl python vba (-aqua) -binfilter -custom-cflags -debug -eds -gnome -graphite -jemalloc (-kdeenablefinal) -nsplugin -odk -pdfimport -templates -test -webdav" LINGUAS="-de -en_GB -en_ZA -es -fr -hu -it" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB
Comment 10 Egor Y. Egorov 2011-12-06 03:23:30 UTC
Created attachment 294923 [details]
strace.out

strace python2.7 test.py -f &> /tmp/strace.out
Comment 11 Egor Y. Egorov 2011-12-06 03:25:34 UTC
Sorry, I posted a wrong direction. This should have been published in #392883
Comment 12 Egor Y. Egorov 2012-01-16 02:29:47 UTC
Patch is still needed on 3.4.99.3
Comment 13 David 2012-02-09 03:46:15 UTC
This bug has references to libreoffice-3.4.2.3, libreoffice-3.4.4, and 3.4.99.3.

Since none of these ebuilds exist in the Portage tree anymore, can this bug be closed?
Comment 14 Egor Y. Egorov 2012-02-09 03:59:26 UTC
On 3.4.5.2 and 3.5.0-r2 bug is not reproduced. 
In my opinion, the bug can be closed.
Comment 15 Egor Y. Egorov 2012-02-09 04:54:23 UTC
I'm sorry, but I was wrong. A bug exists, but plays a little differently.
Reproduced as follows.
1. In the first terminal, run the following command office:
$ soffice "--accept=socket,host=localhost,port=2002;urp;" --invisible

2. Create a file with the following contents:

$ cat out.py
#!/usr/bin/env python 
# -*- coding: utf-8 -*- 
import sys 
sys.path.append('/usr/lib/libreoffice/program') 
sys.path.append('/usr/lib/libreoffice/basis-link/program') 
import os 
import uno 

goServiceManager = False  

def getServiceManager( cHost="localhost", cPort="2002" ):  
        global goServiceManager  
        connectionFlag = 0 
        oContext = 0  
        if not goServiceManager:  
                oLocalContext = uno.getComponentContext()  
                oLocalResolver = oLocalContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", oLocalContext )  
                while oContext == 0: 
                        oContext = getContext(oLocalResolver, cHost, cPort) 
                        connectionFlag = connectionFlag + 1 
                        print connectionFlag     
                goServiceManager = oContext.ServiceManager  
        return goServiceManager  
def createUnoService( cClass ): 
        oServiceManager = getServiceManager() 
        oObj = oServiceManager.createInstance( cClass ) 
        return oObj 
def getContext(oLocalResolver, cHost="localhost", cPort="2002"): 
        try: 
                oContext = oLocalResolver.resolve( "uno:socket,host=" + cHost + ",port=" + cPort + ";urp;StarOffice.ComponentContext" ) 
                print "getContext" 
        except:  
                oContext = 0 
                print "\n getContext is false \n" 
                time.sleep(2) 
        return oContext  

createUnoService("com.sun.star.frame.Desktop")

3. Run:
$ python out.py 

Result:
Traceback (most recent call last):
  File "out.py", line 37, in <module>
    createUnoService("com.sun.star.frame.Desktop")
  File "out.py", line 25, in createUnoService
    oObj = oServiceManager.createInstance( cClass ) 
__main__.RuntimeException: Binary URP bridge disposed during call

If set URE_BOOTSTRAP="file:///usr/lib/libreoffice/program/fundamentalrc", command is executed without traceback.
Comment 16 Egor Y. Egorov 2012-02-09 05:05:18 UTC
Created attachment 301337 [details]
out.py

file to reproduce the bug
Comment 17 Egor Y. Egorov 2012-02-09 05:07:13 UTC
Reproduced on libreoffice-3.5.0.1, libreoffice-3.4.5.2 and libreoffice-bin-3.4.3.2-r1
Comment 18 Tomáš Chvátal (RETIRED) gentoo-dev 2012-03-01 13:16:54 UTC
This bug is fixed in 3.5.9999 and 9999 ebuilds.
Thus it should be working staring in 3.5.1.

Please reopen if it is still not fixed for you.