Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 06/08/2012 09:49 AM, Stephan Bergmann wrote:
On 06/08/2012 09:22 AM, David Ostrovsky wrote:
2. on Linux I'm testing the clean build with --enable-python=internal,
and it seems not to work: opening Tools=>Macros=>Organize Macros=>Python
and trying to open Hello World python Macor. I do not see any macros
available but see this warning in console

[david@wizball program (master)]$ ./soffice.bin --writer
'import site' failed; use -v for traceback

Any ideas how to proceed?

I can have a look.

Attached pyuno.patch addresses three problems that I discovered:

* The sed call in pyuno/CustomTarget_python_shell.mk used wrong variable names, so that expansions in the python wrapper script were empty.

** The pyuno/zipcore/python.sh also contains NOMACSECTION and MACSECTION blocks, and the original pyuno/zipcore/makefile.mk made sure to only include one of them. This still needs to be fixed.

* SAL_DLLPUBLIC_EXPORT was missing from pyuno/source/module/pyuno_dlopenwrapper.c, so that the pyuno.so wrapper did not export initpyuno.

* The program/python-core-2.6.1/ tree was missing from the installation set. Getting this back was a bit tricky, as the old system zipped together a temporary tree with some python-core-2.6.1/lib/ structure, that ended up with that hierarchy included in the zip, and scp2 specified to unzip it into the program directory. I changed that to zip together the flat content of $(OUTDIR)/lib/python, and instead explicitly create the python-core-2.6.1/lib hierarchy in scp2 into which to then unzip the zip file.

** Ideally, the "lib" directory could be removed from the hierarchy completely, but that would require changes to all the places that set up PYTHONPATH etc.

** The original pyuno/zipcore/makefile.mk called strip on the files that went into the zip. From the recent general discussion whether or not to strip when building LO, it indeed seems acceptable to just drop that.

** We should also think about build dependencies, so that the zip file gets recreated whenever its content would change. Maybe it would be best to move creation of the zip file to the python module?

Then, both executing ".../program/python -c 'import uno'" in the installation set and running the Hello World macro from "Tools - Macros..." worked fine for me on Linux (the former of course only by luck, printing a "NONMACSECTION: command not found" message; see above).

Stephan
diff --git a/pyuno/CustomTarget_python_shell.mk b/pyuno/CustomTarget_python_shell.mk
index ea87a9b..9dce854 100644
--- a/pyuno/CustomTarget_python_shell.mk
+++ b/pyuno/CustomTarget_python_shell.mk
@@ -42,8 +42,8 @@ endif
 $(call gb_CustomTarget_get_workdir,pyuno/python_shell)/python.sh : 
$(SRCDIR)/pyuno/zipcore/python.sh | \
     $(call gb_CustomTarget_get_workdir,pyuno/python_shell)/.dir
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),SED,1)
-       sed -e "s/%%PYVERSION%%/$(PYTHON_SHELL_VERSION)/g" -e \
-    "s/%%OOO_LIBRARY_PATH_VAR%%/$(OOO_LIBRARY_PATH_VAR)/g" \
+       sed -e "s/%%PYVERSION%%/$(pyuno_PYTHON_SHELL_VERSION)/g" -e \
+    "s/%%OOO_LIBRARY_PATH_VAR%%/$(gb_Helper_LIBRARY_PATH_VAR)/g" \
     $(PYTHON_SHELL_STRIPRULE) < $? > $@
        chmod +x $@
 
diff --git a/pyuno/CustomTarget_zipcore.mk b/pyuno/CustomTarget_zipcore.mk
index 3024355..171e3d2 100644
--- a/pyuno/CustomTarget_zipcore.mk
+++ b/pyuno/CustomTarget_zipcore.mk
@@ -38,7 +38,7 @@ $(call gb_CustomTarget_get_target,pyuno/zipcore) : \
 $(call gb_CustomTarget_get_workdir,pyuno/zipcore)/$(pyuno_PYTHON_ARCHIVE_NAME) :| \
     $(call gb_CustomTarget_get_workdir,pyuno/zipcore)/.dir
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ZIP,1)
-       cd $(OUTDIR)/lib/ && zip $@ `$(FIND) python -type f | $(GREP) -v "\.pyc" | $(GREP) -v 
"\.py~" | $(GREP) -v .orig | $(GREP) -v _failed`
+       cd $(OUTDIR)/lib/python && zip $@ `$(FIND) . -type f | $(GREP) -v "\.pyc" | $(GREP) -v 
"\.py~" | $(GREP) -v .orig | $(GREP) -v _failed`
 
 # TODO: implement this if 
 
diff --git a/pyuno/source/module/pyuno_dlopenwrapper.c b/pyuno/source/module/pyuno_dlopenwrapper.c
index 3bdc912..cb17c51 100644
--- a/pyuno/source/module/pyuno_dlopenwrapper.c
+++ b/pyuno/source/module/pyuno_dlopenwrapper.c
@@ -84,14 +84,14 @@ static void * load(void * address, char const * symbol) {
 
 #if PY_MAJOR_VERSION >= 3
 
-PyObject * PyInit_pyuno(void) {
+SAL_DLLPUBLIC_EXPORT PyObject * PyInit_pyuno(void) {
     return
         ((PyObject * (*)(void)) load((void *) &PyInit_pyuno, "PyInit_pyuno"))();
 }
 
 #else
 
-void initpyuno(void) {
+SAL_DLLPUBLIC_EXPORT void initpyuno(void) {
     ((void (*)(void)) load((void *) &initpyuno, "initpyuno"))();
 }
 
diff --git a/scp2/source/python/file_python.scp b/scp2/source/python/file_python.scp
index 194394d..e21f0a1 100644
--- a/scp2/source/python/file_python.scp
+++ b/scp2/source/python/file_python.scp
@@ -73,13 +73,26 @@ File gid_File_Py_Pythonloader
 End
 
 #ifndef SYSTEM_PYTHON
+#ifndef MACOSX
+Directory gid_Dir_Py_PythonCore
+    ParentID = gid_Brand_Dir_Program;
+    HostName = STRING(CONCAT2(python-core-,PYVERSION));
+END
+
+Directory gid_Dir_Py_PythonCore_Lib
+    ParentID = gid_Dir_Py_PythonCore;
+    HostName = "lib";
+END
+#endif
+
 File gid_File_Py_Python_Core
     TXT_FILE_BODY;
-    Dir = gid_Brand_Dir_Program;
   #ifdef MACOSX
+    Dir = gid_Brand_Dir_Program;
     Name = "OOoPython.framework.zip";
     Styles = (ARCHIVE,USE_INTERNAL_RIGHTS);
   #else
+    Dir = gid_Dir_Py_PythonCore_Lib;
     Name = STRING(CONCAT3(python-core-,PYVERSION,.zip));
     Styles = (ARCHIVE);
   #endif
diff --git a/scp2/source/python/module_python.scp b/scp2/source/python/module_python.scp
index 6ee8345..74ca1c5 100644
--- a/scp2/source/python/module_python.scp
+++ b/scp2/source/python/module_python.scp
@@ -40,7 +40,8 @@ Module gid_Module_Optional_Pyuno
             gid_Dir_PythonFramework_Versions_ver_bin,
             gid_Dir_PythonFramework_Versions_ver_lib,
             gid_Dir_PythonFramework_Versions_ver_lib_pythonver,
-            gid_Dir_PythonFramework_Versions_ver_lib_pythonver_config);
+            gid_Dir_PythonFramework_Versions_ver_lib_pythonver_config,
+            gid_Dir_Py_PythonCore, gid_Dir_Py_PythonCore_Lib);
     Files = 
(gid_File_Pyuno,gid_File_Lib_Pyuno,gid_File_Lib_Pythonloader,gid_File_Py_Unohelper,gid_File_Py_Uno,gid_File_Py_Pythonloader,gid_File_Py_Python_Core,gid_File_Py_Python_Bin,gid_File_Lib_Python_So,gid_Shortcut_Lib_Python_So,gid_File_Scripts_Python,gid_File_Share_Registry_Pyuno_Xcd);
     Unixlinks = (gid_Unixlink_Python_Headers,
                  gid_Unixlink_Python_Resources,

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.