- 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 I haven't actually tested it with python 3.7 (it builds fine though), but it still works with 3.6.5 on my Leap 15.0 system. OBS-URL: https://build.opensuse.org/request/show/670582 OBS-URL: https://build.opensuse.org/package/show/science/FreeCAD?expand=0&rev=55
63 lines
2.2 KiB
Diff
63 lines
2.2 KiB
Diff
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
|