[Libreoffice-commits] .: Branch 'libreoffice-3-5' - pyuno/source
pyuno/source/module/pyuno.cxx | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) New commits: commit 8d7726c6a54cd65700f4d3183baef7800aaeced5 Author: David Bolen db3l@gmail.com Date: Fri Mar 16 22:10:24 2012 +0100 fdo#46926: PyUNO_cmp: return acquired reference (cherry picked from commit 742dca7366ba6ac3c58b1df6ee548788f4ce24e7) Signed-off-by: Miklos Vajna vmik...@suse.cz diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index 7f5f0b5..b712ae4 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -595,6 +595,8 @@ int PyUNO_setattr (PyObject* self, char* name, PyObject* value) // ensure object identity and struct equality static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op ) { +PyObject *result; + if(op != Py_EQ op != Py_NE) { PyErr_SetString(PyExc_TypeError, only '==' and '!=' comparisions are defined); @@ -602,7 +604,9 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op ) } if( self == that ) { -return (op == Py_EQ ? Py_True : Py_False); +result = (op == Py_EQ ? Py_True : Py_False); +Py_INCREF(result); +return result; } try { @@ -624,14 +628,18 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op ) Reference XMaterialHolder xOther( other-members-xInvocation,UNO_QUERY ); if( xMe-getMaterial() == xOther-getMaterial() ) { -return (op == Py_EQ ? Py_True : Py_False); +result = (op == Py_EQ ? Py_True : Py_False); +Py_INCREF(result); +return result; } } else if( tcMe == com::sun::star::uno::TypeClass_INTERFACE ) { if( me-members-wrappedObject == other-members-wrappedObject ) { -return (op == Py_EQ ? Py_True : Py_False); +result = (op == Py_EQ ? Py_True : Py_False); +Py_INCREF(result); +return result; } } } @@ -641,7 +649,10 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op ) { raisePyExceptionWithAny( makeAny( e ) ); } -return (op == Py_EQ ? Py_False : Py_True); + +result = (op == Py_EQ ? Py_False : Py_True); +Py_INCREF(result); +return result; } /* Python 2 has a tp_flags value for rich comparisons. Python 3 does not (on by default) */ ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - pyuno/source
pyuno/source/module/makefile.mk | 43 ++-- pyuno/source/module/pyuno_dlopenwrapper.c | 79 ++ 2 files changed, 86 insertions(+), 36 deletions(-) New commits: commit 51967dab002323b62f4f8f635052ab12ceb2b2ad Author: Stephan Bergmann sberg...@redhat.com Date: Thu Feb 16 16:42:58 2012 +0100 Reintroduce pyuno.so wrapper around libpyuno.so ...it was cleaned away by a09ce46818fd4d5e08b3af9a478501cd8ef5b4fe Port PyUno to support Python 3 but is still needed to make sure libpyuno.so is loaded RTLD_GLOBAL (Python apparently loads its modules RTLD_LOCAL). At least with pre 4.5 GCC this can cause problems with C++ exception handling, see the mail thread starting at http://lists.freedesktop.org/archives/libreoffice/2012-February/025166.html LibO 3.5RC2: terminate called after throwing an instance of 'com::sun::star::registry::InvalidRegistryException' for details. (cherry picked from commit 0b1be1ce0e0ac7b34c4b73d53f4bf32ec5df7290) ...plus... Adapt pyuno.so wrapper to Python 3 support (cherry picked from commit 1bb0d979b5ac5ed0cd831c6c8c0ab55dc2621eba) Signed-off-by: Michael Meeks michael.me...@suse.com diff --git a/pyuno/source/module/makefile.mk b/pyuno/source/module/makefile.mk index f72e1c3..714a120 100644 --- a/pyuno/source/module/makefile.mk +++ b/pyuno/source/module/makefile.mk @@ -50,6 +50,9 @@ EXTRA_FRAMEWORK_FLAG=-framework Python .ENDIF # .IF $(EXTRA_CFLAGS)!= .IF $(GUI) == UNX +# python expects modules without the lib prefix +# pyuno.so even on Mac OS X, because it is a python module +PYUNO_MODULE=$(DLLDEST)$/pyuno.so PYUNORC=pyunorc .ELSE .IF $(CROSS_COMPILING) != YES @@ -109,6 +112,7 @@ DEFLIB1NAME=$(TARGET) ALLTAR : \ $(DLLDEST)/uno.py \ $(DLLDEST)/unohelper.py \ +$(PYUNO_MODULE) \ $(MISC)/$(PYUNORC) \ $(LB)/lib$(TARGET).a @@ -116,17 +120,10 @@ $(LB)/lib$(TARGET).a: $(MISC)/$(TARGET).def $(DLLTOOL) --dllname $(TARGET)$(DLLPOST) --input-def=$(MISC)/$(TARGET).def --kill-at --output-lib=$(LB)/lib$(TARGET).a .ELSE -.IF $(GUI)!=WNT -# For some reason the build breaks on Windows if this is listed in the -# prerequisite list of ALLTAR, but pyuno.pyd still gets produced. Go -# figure. But we need it on non-Windows. -targetdll=$(LB)/$(TARGET)$(DLLPOST) -.ENDIF - ALLTAR : \ $(DLLDEST)/uno.py \ $(DLLDEST)/unohelper.py \ -$(targetdll) \ +$(PYUNO_MODULE) \ $(MISC)/$(PYUNORC) .ENDIF .ENDIF @@ -141,6 +138,29 @@ $(MISC)/framework_link : $(COMMAND_ECHO)ln -sf $(SOLARLIBDIR)/OOoPython.framework $(LB)/OOoPython.framework @touch $@ +.IF $(GUI) == UNX +$(PYUNO_MODULE) : $(SLO)$/pyuno_dlopenwrapper.obj +.IF $(OS) == LINUX +@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSRUNPATH_OOO) $(LINKFLAGSSHLCUI) -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(MISC)$/$(@:b).cmd +.ELIF $(OS) == SOLARIS +@echo ld -G -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(MISC)$/$(@:b).cmd +.ELIF $(OS) == FREEBSD +@echo ld -shared -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(MISC)$/$(@:b).cmd +.ELIF $(OS) == NETBSD +@echo $(LINK) $(LINKFLAGSSHLCUI) -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(MISC)$/$(@:b).cmd +.ELIF $(OS) == OPENBSD +@echo ld -shared -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(MISC)$/$(@:b).cmd +.ELIF $(OS) == DRAGONFLY +@echo ld -shared -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(MISC)$/$(@:b).cmd +.ELIF $(OS) == MACOSX +@echo $(CC) -bundle -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(EXTRA_LINKFLAGS) $(EXTRA_FRAMEWORK_FLAG) $(MISC)$/$(@:b).cmd +.ELSE +@echo $(LINK) $(LINKFLAGSSHLCUI) -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(MISC)$/$(@:b).cmd +.ENDIF +cat $(MISC)$/$(@:b).cmd +@+source $(MISC)$/$(@:b).cmd +.ENDIF + $(MISC)/$(PYUNORC) : pyuno -rm -f $@ cat pyuno $@ @@ -149,11 +169,4 @@ $(MISC)/pyuno.flt : pyuno.flt -rm -f $@ cat $? $@ -.IF $(DLLPRE)!= -# python does not accept the lib prefix in the module library -$(LB)/$(TARGET)$(DLLPOST) : $(LB)/$(DLLPRE)$(TARGET)$(DLLPOST) - -rm -f $@ - ln -s $? $@ -.ENDIF - .ENDIF # L10N_framework diff --git a/pyuno/source/module/pyuno_dlopenwrapper.c b/pyuno/source/module/pyuno_dlopenwrapper.c index 1ace044..3bdc912 100644 --- a/pyuno/source/module/pyuno_dlopenwrapper.c +++ b/pyuno/source/module/pyuno_dlopenwrapper.c @@ -26,38 +26,75 @@ * / -#include rtl/string.h +/* make Python.h go first as a hack to work around _POSIX_C_SOURCE redefinition + warnings: */ +#include Python.h + +#include sal/config.h #include stdlib.h #include string.h -#ifdef LINUX -# ifndef __USE_GNU -# define __USE_GNU -# endif +#if defined LINUX !defined __USE_GNU +#define __USE_GNU #endif #include dlfcn.h -void initpyuno () -{ -Dl_info dl_info; -void (*func)(void); +#include rtl/string.h -if (dladdr((void*)initpyuno, dl_info)
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - pyuno/source
pyuno/source/loader/pythonloader.py |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4a7ba0cbaf5311342c48faeb0dc7269c47560fde Author: Caolán McNamara caol...@redhat.com Date: Mon Dec 12 14:17:08 2011 + Let's not have debug spew all the time (cherry picked from commit fb37327df4153a31d7ba28e2bc3f742f4efc9f34) Signed-off-by: Caolán McNamara caol...@redhat.com diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py index c4fa69d..da3efa7 100644 --- a/pyuno/source/loader/pythonloader.py +++ b/pyuno/source/loader/pythonloader.py @@ -35,7 +35,7 @@ from com.sun.star.loader import XImplementationLoader from com.sun.star.lang import XServiceInfo MODULE_PROTOCOL = vnd.openoffice.pymodule: -DEBUG = 1 +DEBUG = 0 g_supportedServices = com.sun.star.loader.Python, # referenced by the native C++ loader ! g_implementationName = org.openoffice.comp.pyuno.Loader # referenced by the native C++ loader ! ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-5' - pyuno/source wizards/com
pyuno/source/loader/pythonloader.py | 11 ++- wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py |1 - 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit a94660eaaad9b662812fe0d3aee7179cf41c0ad9 Author: Lionel Elie Mamane lio...@mamane.lu Date: Mon Dec 12 22:12:40 2011 +0100 fix loading of python-uno module by package.module name diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py index eef1bd6..7a66cfa 100644 --- a/pyuno/source/loader/pythonloader.py +++ b/pyuno/source/loader/pythonloader.py @@ -111,16 +111,18 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): g_loadedComponents[url] = mod return mod elif vnd.openoffice.pymodule == protocol: -# the failure is on symbol lookup later in the parent ... -print (Warning: Python module loading is almost certainly pre-broken) nSlash = dependent.rfind('/') if -1 != nSlash: path = unohelper.fileUrlToSystemPath( dependent[0:nSlash] ) dependent = dependent[nSlash+1:len(dependent)] if not path in sys.path: sys.path.append( path ) -var = __import__( dependent ) -return var +mod = __import__( dependent ) +path_component, dot, rest = dependent.partition('.') +while dot == '.': +path_component, dot, rest = rest.partition('.') +mod = getattr(mod, path_component) +return mod else: if DEBUG: print(Unknown protocol ' + protocol + '); @@ -140,7 +142,6 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): mod = self.getModuleFromUrl( locationUrl ) implHelper = mod.__dict__.get( g_ImplementationHelper , None ) if DEBUG: -print (dump stuff) print (Fetched ImplHelper as + str(implHelper)) if implHelper == None: return mod.getComponentFactory( implementationName, self.ctx.ServiceManager, regKey ) diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index c6b1a08..37ec3b1 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -59,7 +59,6 @@ class FaxWizardDialogImpl(FaxWizardDialog): def startWizard(self, xMSF): self.running = True try: -print entra #Number of steps on WizardDialog self.nMaxStep = 5 ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits