Issue 90701 - PyUNO broken in OOo 3.0 DEV300 with system python
Summary: PyUNO broken in OOo 3.0 DEV300 with system python
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P4 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: oooqa, regression
Depends on:
Blocks:
 
Reported: 2008-06-13 15:33 UTC by kendy
Modified: 2017-05-20 11:27 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kendy 2008-06-13 15:33:46 UTC
Issue 88211 still seems to be valid with system python; or at least I and 
Caolan both fail to run DocumentConverter.py (I tried with m14, Caolan with 
m19).

I did some desperate attempts to work it around like exporting 
URE_BOOTSTRAP='vnd.sun.star.pathname:<path_to_the_install>/program/fundamentalrc', 
but so far to no avail :-(

Please - is it a bug, or am I doing something wrong?
Comment 1 Stephan Bergmann 2008-06-13 16:11:23 UTC
@kendy:  You need at least DEV300m19 to get this working at all.

@cmc:  Figuring from your comment to issue 88211 that you are willing to create
a fix for this issue?  ;)  Thanks.

As discussed at
<http://udk.openoffice.org/servlets/ReadMsg?list=dev&msgNo=4040>, SYSTEM_PYTHON
PyUNO is indeed still broken.  For non-SYSTEM_PYTHON, the problem got fixed by
pyuno/zipcore/python.sh:1.10 (which is installed as
/opt/openoffice.org3/program/python), the two main points probably also relevant
for SYSTEM_PYTHON being to (a) "Set LD_LIBRARY_PATH so that 'import pyuno' finds
libpyuno.so" and (b) "Set URE_BOOTSTRAP so that 'uno.getComponentContext()'
bootstraps a complete OOo UNO environment".
Comment 2 caolanm 2008-06-13 16:23:26 UTC
Crap, its not like I even know what's going on :-)

wrt. a) finding pyuno. We tweak things a bit to make "import uno" work out of
the box anyway by 

echo "import sys" > uno.py
echo "sys.path.append('%{basisinstdir}/program')" >> uno.py

and sticking uno.py in the system python place. I believe that ooo-build has a
(nasty hardcoded to /usr/lib) rpath to make "import pyuno" work. So...

cmc->kendy: does running the suse system python with openoffice.org-pyuno
installed and typing into it
import uno
work ?

I'm not sure if that's sufficient, but I assume its necessary anyway.
Comment 3 caolanm 2008-06-13 16:36:23 UTC
So as sb says, If I just do

export
URE_BOOTSTRAP=vnd.sun.star.path:/usr/lib/openoffice.org3/program/fundamentalrc

then it'll work.

Hmm, now for *my* packaging, even with broffice.org installed, I always have an
openoffice.org3/program/fundamentalrc installed too.

So for me anyway, doing...

echo "import sys, os" > uno.py
echo "sys.path.append('%{basisinstdir}/program')" >> uno.py
echo "os.putenv('URE_BOOTSTRAP',
'vnd.sun.star.pathname:%{oooinstdir}/program/fundamentalrc')

would work fine
Comment 4 caolanm 2008-06-13 16:43:27 UTC
So this is new "fixed" for the fedora system python builds.

I guess the question is if this sort of a fix is upstreamable in any sane way
because we'd need to know in advance where OOo will be installed and we don't
know that until we get to instsetoo_native
Comment 5 caolanm 2008-06-13 17:13:59 UTC
If I had total free reign, I'd take the standard configure --libdir argument as
the basis dir that everything gets installed into and tweak the configure
--disable-epm to export a suitable PKGFORMATSWITCH with a -simple DIR of
that_prefix_dir (as a side effect making all distros use LIBDIR/openoffice.org3
and LIBDIR/openoffice.org as their OOo directories) and make SYSTEM_PYTHON add
into uno.py during the build my above lines.
Comment 6 kendy 2008-06-13 17:38:48 UTC
cmc: So, apparently in openSUSE we don't have pyuno working out of the box, 
what I need to do to get it running is

PYTHONPATH=/usr/lib64/ooo-2.0/program python blah.py
[where blah.py contains just the 'import uno']

According to sb's comment, and with your finding, I hope an additional 
URE_BOOTSTRAP will do it for me when I get to m19 :-)

cmc: Wrt. setting prefixes in the configure, I've filed a bug against is, 
maybe this could go together with it?  It is issue 90430.

pmladek: What do you think, please?
Comment 7 caolanm 2008-06-16 11:37:03 UTC
cmc->kendy: indeed, you either need the debian-esque rpath hack (which would
then need to be extended for the multilib /usr/lib64 on 64bit systems like
suse/redhat) in ooo-build, or you need the 

import sys
sys.path.append(/path/to/office/program)

hack at the top of uno.py like fedora, and the relocation into the "standard"
python locations, here's the dump from my own spec to do the relocation and fixup

%define instdir %{_libdir}
%define baseinstdir %{instdir}/openoffice.org
%define basisinstdir %{baseinstdir}/basis3.0

%define python_py_sitearch %(%{__python} -c "from distutils.sysconfig import
get_python_lib; print get_python_lib(0)")

# move python bits into site-packages
mkdir -p $RPM_BUILD_ROOT/%{python_py_sitearch}
pushd $RPM_BUILD_ROOT/%{python_py_sitearch}
echo "import sys, os" > uno.py
echo "sys.path.append('%{basisinstdir}/program')" >> uno.py
echo "os.putenv('URE_BOOTSTRAP',
'vnd.sun.star.pathname:%{oooinstdir}/program/fundamentalrc')" >> uno.py
cat $RPM_BUILD_ROOT/%{basisinstdir}/program/uno.py >> uno.py
rm -f $RPM_BUILD_ROOT/%{basisinstdir}/program/uno.py*
mv -f $RPM_BUILD_ROOT/%{basisinstdir}/program/unohelper.py* .
popd
Comment 8 Stephan Bergmann 2009-04-01 09:06:03 UTC
Re <#desc2>, see issue 97629 for the additional requirement (c) to set the
UNO_PATH environment variable so that officehelper.py can start soffice.
Comment 9 rene 2010-06-23 08:56:32 UTC
FTR, debian in the meanwhile also uses caolans hack because the rpath hack
didn't work anymore :)
Comment 10 Marcus 2017-05-20 11:27:35 UTC
Reset assigne to the default "issues@openoffice.apache.org".