SHA256
1
0
forked from pool/FreeCAD

Accepting request 671003 from science

- update to current branch:
  - Spreadsheet: Fixed issue #3361.

- Add upstream patches to fix build with python 3.7:
  * get-rid-of-private-function-_PyImport_FixupBuiltin-for-__FreeCADBase__-module.patch
  * get-rid-of-private-function-_PyImport_FixupBuiltin-for-FreeCAD-and-FreeCADGui-modules.patch

OBS-URL: https://build.opensuse.org/request/show/671003
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/FreeCAD?expand=0&rev=10
This commit is contained in:
Stephan Kulow 2019-02-08 11:09:46 +00:00 committed by Git OBS Bridge
commit 92a6f175c8
8 changed files with 212 additions and 12 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a53986ef6a197396e3fca6558fe162027ee2b71354594d0874ea6b7af72e6b54
size 385254415

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:74d557629532bc687e84361b13686888667c14368a6fda9990f42e8a90338405
size 385254927

View File

@ -1,7 +1,7 @@
#
# spec file for package FreeCAD-test
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,12 +12,12 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: FreeCAD-test
Version: 0.17.1534399137.9948ee4f1
Version: 0.17.1545162057.e1db7bff8
Release: 0
Summary: Meta source package that runs the FreeCAD testsuite when built
License: LGPL-2.0-or-later AND GPL-2.0-or-later

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Feb 4 08:28:22 UTC 2019 - Adrian Schröter <adrian@suse.de>
- update to current branch:
- Spreadsheet: Fixed issue #3361.
-------------------------------------------------------------------
Fri Feb 1 09:42:55 UTC 2019 - wbauer@tmo.at
- Add upstream patches to fix build with python 3.7:
* get-rid-of-private-function-_PyImport_FixupBuiltin-for-__FreeCADBase__-module.patch
* get-rid-of-private-function-_PyImport_FixupBuiltin-for-FreeCAD-and-FreeCADGui-modules.patch
-------------------------------------------------------------------
Wed Sep 5 14:50:23 UTC 2018 - Jan Engelhardt <jengelh@inai.de>

View File

@ -1,5 +1,5 @@
name: FreeCAD
version: 0.17.1534399137.9948ee4f1
mtime: 1534399137
commit: 9948ee4f1570df9216862a79705afb367b2c6ffb
version: 0.17.1545162057.e1db7bff8
mtime: 1545162057
commit: e1db7bff8ff36439373eb9a426567d8afe289c4d

View File

@ -1,7 +1,7 @@
#
# spec file for package FreeCAD
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,14 +12,14 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define x_prefix %{_libdir}/%{name}
Name: FreeCAD
Version: 0.17.1534399137.9948ee4f1
Version: 0.17.1545162057.e1db7bff8
Release: 0
Summary: General Purpose 3D CAD Modeler
License: LGPL-2.0-or-later AND GPL-2.0-or-later
@ -37,6 +37,10 @@ Patch2: 0001-find-openmpi2-include-files.patch
Patch3: fix-draft-module-with-python3.patch
# PATCH-FIX-UPSTREAM -- fix-build-with-Qt5_11.diff
Patch4: fix-build-with-Qt5_11.diff
# PATCH-FIX-UPSTREAM -- https://github.com/FreeCAD/FreeCAD/commit/8c08635d3
Patch5: get-rid-of-private-function-_PyImport_FixupBuiltin-for-__FreeCADBase__-module.patch
# PATCH-FIX-UPSTREAM -- https://github.com/FreeCAD/FreeCAD/commit/b79e1bfee
Patch6: get-rid-of-private-function-_PyImport_FixupBuiltin-for-FreeCAD-and-FreeCADGui-modules.patch
BuildRequires: Coin-devel
#BuildRequires: SoQt-devel
#BuildRequires: libmed-devel # needed for FEM module, but requires older hdf5 lib

View File

@ -0,0 +1,121 @@
From b79e1bfee45d003e5ba646d828faca5d673f3e9b Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Sat, 1 Sep 2018 19:57:15 +0200
Subject: [PATCH] get rid of private function _PyImport_FixupBuiltin for
FreeCAD and FreeCADGui modules
---
src/App/Application.cpp | 38 ++++++++++++++++++++++++++++++--------
src/Gui/Application.cpp | 6 ++++--
src/Main/MainPy.cpp | 4 +++-
3 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/src/App/Application.cpp b/src/App/Application.cpp
index 82270e3eea0..0895a8c83ac 100644
--- a/src/App/Application.cpp
+++ b/src/App/Application.cpp
@@ -226,6 +226,21 @@ init_freecad_base_module(void)
};
return PyModule_Create(&BaseModuleDef);
}
+
+// Set in inside Application
+static PyMethodDef* __AppMethods = nullptr;
+
+PyMODINIT_FUNC
+init_freecad_module(void)
+{
+ static struct PyModuleDef FreeCADModuleDef = {
+ PyModuleDef_HEAD_INIT,
+ "FreeCAD", FreeCAD_doc, -1,
+ __AppMethods,
+ NULL, NULL, NULL, NULL
+ };
+ return PyModule_Create(&FreeCADModuleDef);
+}
#endif
Application::Application(std::map<std::string,std::string> &mConfig)
@@ -239,14 +254,15 @@ Application::Application(std::map<std::string,std::string> &mConfig)
// setting up Python binding
Base::PyGILStateLocker lock;
#if PY_MAJOR_VERSION >= 3
- static struct PyModuleDef FreeCADModuleDef = {
- PyModuleDef_HEAD_INIT,
- "FreeCAD", FreeCAD_doc, -1,
- Application::Methods,
- NULL, NULL, NULL, NULL
- };
- PyObject* pAppModule = PyModule_Create(&FreeCADModuleDef);
- _PyImport_FixupBuiltin(pAppModule, "FreeCAD");
+ PyObject* modules = PyImport_GetModuleDict();
+
+ __AppMethods = Application::Methods;
+ PyObject* pAppModule = PyImport_ImportModule ("FreeCAD");
+ if (!pAppModule) {
+ PyErr_Clear();
+ pAppModule = init_freecad_module();
+ PyDict_SetItemString(modules, "FreeCAD", pAppModule);
+ }
#else
PyObject* pAppModule = Py_InitModule3("FreeCAD", Application::Methods, FreeCAD_doc);
#endif
@@ -282,6 +298,11 @@ Application::Application(std::map<std::string,std::string> &mConfig)
#if PY_MAJOR_VERSION >= 3
PyObject* pBaseModule = PyImport_ImportModule ("__FreeCADBase__");
+ if (!pBaseModule) {
+ PyErr_Clear();
+ pBaseModule = init_freecad_base_module();
+ PyDict_SetItemString(modules, "__FreeCADBase__", pBaseModule);
+ }
#else
PyObject* pBaseModule = Py_InitModule3("__FreeCADBase__", NULL, Base_doc);
#endif
@@ -1427,6 +1448,7 @@ void Application::initConfig(int argc, char ** argv)
// init python
#if PY_MAJOR_VERSION >= 3
+ PyImport_AppendInittab ("FreeCAD", init_freecad_module);
PyImport_AppendInittab ("__FreeCADBase__", init_freecad_base_module);
#endif
mConfig["PythonSearchPath"] = Interpreter().init(argc,argv);
diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp
index 33ddde2b4c6..8715c8d6e52 100644
--- a/src/Gui/Application.cpp
+++ b/src/Gui/Application.cpp
@@ -345,7 +345,8 @@ Application::Application(bool GUIenabled)
#if PY_MAJOR_VERSION >= 3
// if this returns a valid pointer then the 'FreeCADGui' Python module was loaded,
// otherwise the executable was launched
- PyObject *module = PyImport_AddModule("FreeCADGui");
+ PyObject* modules = PyImport_GetModuleDict();
+ PyObject* module = PyDict_GetItemString(modules, "FreeCADGui");
if (!module) {
static struct PyModuleDef FreeCADGuiModuleDef = {
PyModuleDef_HEAD_INIT,
@@ -354,7 +355,8 @@ Application::Application(bool GUIenabled)
NULL, NULL, NULL, NULL
};
module = PyModule_Create(&FreeCADGuiModuleDef);
- _PyImport_FixupBuiltin(module, "FreeCADGui");
+
+ PyDict_SetItemString(modules, "FreeCADGui", module);
}
else {
// extend the method list
diff --git a/src/Main/MainPy.cpp b/src/Main/MainPy.cpp
index 061740903c0..58b86fa7991 100644
--- a/src/Main/MainPy.cpp
+++ b/src/Main/MainPy.cpp
@@ -225,7 +225,9 @@ PyMOD_INIT_FUNC(FreeCAD)
free(argv);
#if PY_MAJOR_VERSION >= 3
- PyObject* module = _PyImport_FindBuiltin("FreeCAD");
+ //PyObject* module = _PyImport_FindBuiltin("FreeCAD");
+ PyObject* modules = PyImport_GetModuleDict();
+ PyObject* module = PyDict_GetItemString(modules, "FreeCAD");
if (!module) {
PyErr_SetString(PyExc_ImportError, "Failed to load FreeCAD module!");
}

View File

@ -0,0 +1,62 @@
From 8c08635d301c3418810e5c8984bdb9f2c17cb9dc Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Sat, 1 Sep 2018 16:26:18 +0200
Subject: [PATCH] get rid of private function _PyImport_FixupBuiltin for
__FreeCADBase__ module
---
src/App/Application.cpp | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/App/Application.cpp b/src/App/Application.cpp
index f719cd2375a..82270e3eea0 100644
--- a/src/App/Application.cpp
+++ b/src/App/Application.cpp
@@ -212,6 +212,22 @@ PyDoc_STRVAR(Base_doc,
"like vector, matrix, bounding box, placement, rotation, axis, ...\n"
);
+#if PY_MAJOR_VERSION >= 3
+// This is called via the PyImport_AppendInittab mechanism called
+// during initialization, to make the built-in __FreeCADBase__
+// module known to Python.
+PyMODINIT_FUNC
+init_freecad_base_module(void)
+{
+ static struct PyModuleDef BaseModuleDef = {
+ PyModuleDef_HEAD_INIT,
+ "__FreeCADBase__", Base_doc, -1,
+ NULL, NULL, NULL, NULL, NULL
+ };
+ return PyModule_Create(&BaseModuleDef);
+}
+#endif
+
Application::Application(std::map<std::string,std::string> &mConfig)
: _mConfig(mConfig), _pActiveDoc(0)
{
@@ -265,13 +281,7 @@ Application::Application(std::map<std::string,std::string> &mConfig)
// remove these types from the FreeCAD module.
#if PY_MAJOR_VERSION >= 3
- static struct PyModuleDef BaseModuleDef = {
- PyModuleDef_HEAD_INIT,
- "__FreeCADBase__", Base_doc, -1,
- NULL, NULL, NULL, NULL, NULL
- };
- PyObject* pBaseModule = PyModule_Create(&BaseModuleDef);
- _PyImport_FixupBuiltin(pBaseModule, "__FreeCADBase__");
+ PyObject* pBaseModule = PyImport_ImportModule ("__FreeCADBase__");
#else
PyObject* pBaseModule = Py_InitModule3("__FreeCADBase__", NULL, Base_doc);
#endif
@@ -1416,6 +1426,9 @@ void Application::initConfig(int argc, char ** argv)
# endif
// init python
+#if PY_MAJOR_VERSION >= 3
+ PyImport_AppendInittab ("__FreeCADBase__", init_freecad_base_module);
+#endif
mConfig["PythonSearchPath"] = Interpreter().init(argc,argv);
// Parse the options that have impact on the init process