freecad 0.20.1-1 (x86_64;znver1) 2022-15319
10002

Status published
Submitter mandian [@T] tutanota.com
Platform rolling
Repository unsupported
URL https://abf.openmandriva.org/build_lists/235410
Packages
freecad-0.20.1-1.x86_64.source
freecad-0.20.1-1.x86_64.binary
freecad-debuginfo-0.20.1-1.x86_64.debuginfo
freecad-debugsource-0.20.1-1.x86_64.binary
freecad-0.20.1-1.znver1.source
freecad-0.20.1-1.znver1.binary
freecad-debuginfo-0.20.1-1.znver1.debuginfo
freecad-debugsource-0.20.1-1.znver1.binary
Build Date 2022-09-27 21:30:48 +0000 UTC
Last Updated 2022-09-30 17:28:41.893018553 +0000 UTC
$ git diff --patch-with-stat --summary f9d46936d138ad5a79ba49f8ad2058be2daf61c6..2bc2fa2f6c8642d84b7181d9e9a7417b838fae58

 .abf.yml                          |   2 +-
 freecad-0.20.1-fix_python11.patch | 214 ++++++++++++++++++++++++++++++++++++++
 freecad.spec                      |  26 +++--
 3 files changed, 230 insertions(+), 12 deletions(-)
 create mode 100644 freecad-0.20.1-fix_python11.patch

diff --git a/.abf.yml b/.abf.yml
index 30df52f..f40da4f 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,2 +1,2 @@
 sources:
-  FreeCAD-master.tar.gz: bfcd6a4bebb47146c7b69f1c05e53dfc0b3dd4c5
+  FreeCAD-0.20.1.tar.gz: 67c6159e1c2cd82a960ca2bb842b33db04a1f3a6
diff --git a/freecad-0.20.1-fix_python11.patch b/freecad-0.20.1-fix_python11.patch
new file mode 100644
index 0000000..d543806
--- /dev/null
+++ b/freecad-0.20.1-fix_python11.patch
@@ -0,0 +1,214 @@
+From 1ae55905ba7e89278bf656ebcc57ea1088e8fa44 Mon Sep 17 00:00:00 2001
+From: wmayer <wmayer@users.sourceforge.net>
+Date: Fri, 1 Jul 2022 17:54:50 +0200
+Subject: [PATCH] Py: make FreeCAD to compile with Py3.11
+
+---
+ src/Base/ConsoleObserver.cpp |  6 ++++
+ src/Base/Interpreter.cpp     | 56 ++++++++++++++++++++++++++++++++++++
+ src/Base/PyObjectBase.cpp    |  4 +++
+ src/Base/PyTools.c           | 10 ++++++-
+ src/Gui/Command.cpp          |  7 +++++
+ src/Gui/PythonDebugger.cpp   | 17 +++++++++--
+ 6 files changed, 97 insertions(+), 3 deletions(-)
+
+diff --git a/src/Base/ConsoleObserver.cpp b/src/Base/ConsoleObserver.cpp
+index c6428a7f18be..ab3b3e9157b1 100644
+--- a/src/Base/ConsoleObserver.cpp
++++ b/src/Base/ConsoleObserver.cpp
+@@ -266,7 +266,13 @@ std::stringstream &LogLevel::prefix(std::stringstream &str, const char *src, int
+         PyFrameObject* frame = PyEval_GetFrame();
+         if (frame) {
+             line = PyFrame_GetLineNumber(frame);
++#if PY_VERSION_HEX < 0x030b0000
+             src = PyUnicode_AsUTF8(frame->f_code->co_filename);
++#else
++            PyCodeObject* code = PyFrame_GetCode(frame);
++            src = PyUnicode_AsUTF8(code->co_filename);
++            Py_DECREF(code);
++#endif
+         }
+     }
+     if (print_src && src && src[0]) {
+diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp
+index 2bacea30cbb7..5a476094b749 100644
+--- a/src/Base/Interpreter.cpp
++++ b/src/Base/Interpreter.cpp
+@@ -523,6 +523,7 @@ void InterpreterSingleton::addPythonPath(const char* Path)
+     list.append(Py::String(Path));
+ }
+ 
++#if PY_VERSION_HEX < 0x030b0000
+ const char* InterpreterSingleton::init(int argc,char *argv[])
+ {
+     if (!Py_IsInitialized()) {
+@@ -565,6 +566,61 @@ const char* InterpreterSingleton::init(int argc,char *argv[])
+     PyGILStateLocker lock;
+     return Py_EncodeLocale(Py_GetPath(),nullptr);
+ }
++#else
++namespace {
++void initInterpreter(int argc,char *argv[])
++{
++    PyStatus status;
++    PyConfig config;
++    PyConfig_InitPythonConfig(&config);
++
++    status = PyConfig_SetBytesArgv(&config, argc, argv);
++    if (PyStatus_Exception(status)) {
++        throw Base::RuntimeError("Failed to set config");
++    }
++
++    status = Py_InitializeFromConfig(&config);
++    if (PyStatus_Exception(status)) {
++        throw Base::RuntimeError("Failed to init from config");
++    }
++
++    PyConfig_Clear(&config);
++
++    Py_Initialize();
++    const char* virtualenv = getenv("VIRTUAL_ENV");
++    if (virtualenv) {
++        PyRun_SimpleString(
++            "# Check for virtualenv, and activate if present.\n"
++            "# See https://virtualenv.pypa.io/en/latest/userguide/#using-virtualenv-without-bin-python\n"
++            "import os\n"
++            "import sys\n"
++            "base_path = os.getenv(\"VIRTUAL_ENV\")\n"
++            "if not base_path is None:\n"
++            "    activate_this = os.path.join(base_path, \"bin\", \"activate_this.py\")\n"
++            "    exec(open(activate_this).read(), {'__file__':activate_this})\n"
++        );
++    }
++}
++}
++const char* InterpreterSingleton::init(int argc,char *argv[])
++{
++    try {
++        if (!Py_IsInitialized()) {
++            initInterpreter(argc, argv);
++
++            PythonStdOutput::init_type();
++            this->_global = PyEval_SaveThread();
++        }
++
++        PyGILStateLocker lock;
++        return Py_EncodeLocale(Py_GetPath(),nullptr);
++    }
++    catch (const Base::Exception& e) {
++        e.ReportException();
++        throw;
++    }
++}
++#endif
+ 
+ void InterpreterSingleton::replaceStdOutput()
+ {
+diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp
+index 773a61b259b3..343ab26999f6 100644
+--- a/src/Base/PyObjectBase.cpp
++++ b/src/Base/PyObjectBase.cpp
+@@ -60,7 +60,11 @@ PyObjectBase::PyObjectBase(void* p,PyTypeObject *T)
+   , baseProxy(nullptr)
+   , attrDict(nullptr)
+ {
++#if PY_VERSION_HEX < 0x030b0000
+     Py_TYPE(this) = T;
++#else
++    Py_SET_TYPE(this, T);
++#endif
+     _Py_NewReference(this);
+ #ifdef FC_LOGPYOBJECTS
+     Base::Console().Log("PyO+: %s (%p)\n",T->tp_name, this);
+diff --git a/src/Base/PyTools.c b/src/Base/PyTools.c
+index 71569e26a200..492d0c8563a4 100644
+--- a/src/Base/PyTools.c
++++ b/src/Base/PyTools.c
+@@ -15,8 +15,10 @@ is provided on an as is basis, without warranties of any kind.
+ #include <string.h>
+ #include <assert.h>
+ #include <compile.h>
+-#include <eval.h>
+ #include <frameobject.h>
++#if PY_VERSION_HEX < 0x030b0000
++#include <eval.h>
++#endif
+ 
+ 
+ /*****************************************************************************
+@@ -310,7 +312,13 @@ void PP_Fetch_Error_Text()
+         if(!frame) 
+             return;
+         int line = PyFrame_GetLineNumber(frame);
++#if PY_VERSION_HEX < 0x030b0000
+         const char *file = PyUnicode_AsUTF8(frame->f_code->co_filename);
++#else
++        PyCodeObject* code = PyFrame_GetCode(frame);
++        const char *file = PyUnicode_AsUTF8(code->co_filename);
++        Py_DECREF(code);
++#endif
+ #ifdef FC_OS_WIN32
+         const char *_f = strstr(file, "\\src\\");
+ #else
+diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp
+index c9568e8f0e69..cf555439fcd2 100644
+--- a/src/Gui/Command.cpp
++++ b/src/Gui/Command.cpp
+@@ -657,8 +657,15 @@ void Command::printPyCaller() {
+     if(!frame)
+         return;
+     int line = PyFrame_GetLineNumber(frame);
++#if PY_VERSION_HEX < 0x030b0000
+     const char *file = PyUnicode_AsUTF8(frame->f_code->co_filename);
+     printCaller(file?file:"<no file>",line);
++#else
++    PyCodeObject* code = PyFrame_GetCode(frame);
++    const char* file = PyUnicode_AsUTF8(code->co_filename);
++    printCaller(file?file:"<no file>",line);
++    Py_DECREF(code);
++#endif
+ }
+ 
+ void Command::printCaller(const char *file, int line) {
+diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp
+index 7e731a9dd6af..cd44e9b1c233 100644
+--- a/src/Gui/PythonDebugger.cpp
++++ b/src/Gui/PythonDebugger.cpp
+@@ -563,6 +563,14 @@ void PythonDebugger::hideDebugMarker(const QString& fn)
+     }
+ }
+ 
++#if PY_VERSION_HEX < 0x030900B1
++static PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)
++{
++    Py_INCREF(frame->f_code);
++    return frame->f_code;
++}
++#endif
++
+ // http://www.koders.com/cpp/fidBA6CD8A0FE5F41F1464D74733D9A711DA257D20B.aspx?s=PyEval_SetTrace
+ // http://code.google.com/p/idapython/source/browse/trunk/python.cpp
+ // http://www.koders.com/cpp/fid191F7B13CF73133935A7A2E18B7BF43ACC6D1784.aspx?s=PyEval_SetTrace
+@@ -578,7 +586,9 @@ int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int wha
+ 
+     //no = frame->f_tstate->recursion_depth;
+     //std::string funcname = PyString_AsString(frame->f_code->co_name);
+-    QString file = QString::fromUtf8(PyUnicode_AsUTF8(frame->f_code->co_filename));
++    PyCodeObject* code = PyFrame_GetCode(frame);
++    QString file = QString::fromUtf8(PyUnicode_AsUTF8(code->co_filename));
++    Py_DECREF(code);
+     switch (what) {
+     case PyTrace_CALL:
+         self->depth++;
+@@ -592,7 +602,10 @@ int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int wha
+             //PyObject *str;
+             //str = PyObject_Str(frame->f_code->co_filename);
+             //no = frame->f_lineno;
+-            int line = PyCode_Addr2Line(frame->f_code, frame->f_lasti);
++            PyCodeObject* f_code = PyFrame_GetCode(frame);
++            int f_lasti = PyFrame_GetLineNumber(frame);
++            int line = PyCode_Addr2Line(f_code, f_lasti);
++            Py_DECREF(f_code);
+             //if (str) {
+             //    Base::Console().Message("PROFILING: %s:%d\n", PyString_AsString(str), frame->f_lineno);
+             //    Py_DECREF(str);
diff --git a/freecad.spec b/freecad.spec
index 45243c1..806a754 100644
--- a/freecad.spec
+++ b/freecad.spec
@@ -17,12 +17,12 @@
 # (mandian) use bundled SMESH (upstream use an old version)
 %bcond_with	smesh
 
-%define snapshot 20220205
+#define snapshot 20220205
 
 Summary:	FreeCAD is a general purpose 3D CAD modeler
 Name:		%{name}
-Version:	0.19.4
-Release:	%{?snapshot:0.%{snapshot}.}4
+Version:	0.20.1
+Release:	%{?snapshot:0.%{snapshot}.}1
 License:	GPL and LGPL
 Group: 		Graphics
 Url:		https://freecadweb.org
@@ -38,7 +38,8 @@ Patch3:		freecad-0.19.2-coin4_doc.patch
 # (fedora)
 Patch5:		freecad-unbundled-pycxx.patch
 # (upstream)
-
+# https://github.com/FreeCAD/FreeCAD/commit/1ae55905ba7e89278bf656ebcc57ea1088e8fa44?diff=unified
+Patch6:		freecad-0.20.1-fix_python11.patch 
 BuildRequires: 	cmake
 BuildRequires: 	ninja
 #BuildRequires:	dos2unix
@@ -109,14 +110,14 @@ BuildRequires:	pkgconfig(shiboken2)
 BuildRequires:	pkgconfig(sm)
 BuildRequires:	pkgconfig(sqlite3)
 BuildRequires:	pkgconfig(theora)
-BuildRequires:  pkgconfig(tbb)
+BuildRequires:	pkgconfig(tbb)
 BuildRequires:	pkgconfig(xerces-c)
 BuildRequires: 	pkgconfig(xext)
 BuildRequires:	pkgconfig(xmu)
-BuildRequires:  pkgconfig(xi)
+BuildRequires:	pkgconfig(xi)
 BuildRequires:	pkgconfig(xt)
 BuildRequires:	pkgconfig(zlib)
-BuildRequires:	python-pivy
+BuildRequires:	python3dist(pivy)
 %if %{with pycxx}
 BuildRequires:	python3dist(cxx)
 BuildRequires:	python-cxx-devel
@@ -131,11 +132,16 @@ BuildRequires:	vtk-devel
 BuildRequires:	zipios++-devel
 %endif
 
-Requires:	python-pivy
+Requires:	python3dist(pivy)
+Requires:	python-matplotlib-qt5
+Requires:	python3dist(matplotlib)
+#Requires:	python3dist(pycollada)
 %if %{with shiboken}
-Requires:	pyside2-core
+Requires:	pyside2
 Requires:	python3dist(shiboken2)
 %endif
+#Requires:	openscad
+Requires:	qt5-assistant
 
 %description
 FreeCAD is a general purpose feature-based, parametric 3D modeler for
@@ -153,9 +159,7 @@ platforms.
 
 %files
 %doc ChangeLog.txt
-%{_docdir}/%{name}/CONTRIBUTORS
 %{_docdir}/%{name}/LICENSE.html
-%{_docdir}/%{name}/freecad.q*
 %{_docdir}/%{name}/ThirdPartyLibraries.html
 %{_bindir}/*
 %{_datadir}/applications/%{name}.desktop
Not Available

mandian [@T] tutanota.comNo Comment.568d 12hrs
benbullard79 [@T] cox.netNo Comment.567d 18hrs
benbullard79 [@T] cox.netNo Comment.567d 16hrs