diff --git a/python38.patch b/python38.patch new file mode 100644 index 0000000..81c2a63 --- /dev/null +++ b/python38.patch @@ -0,0 +1,176 @@ +From 257b9d7b18d5f3db3fe099dc18f230e23f7dfbab Mon Sep 17 00:00:00 2001 +From: David Gobbi +Date: Tue, 20 Aug 2019 17:02:24 -0600 +Subject: [PATCH] Compatibility for Python 3.8 + +The PyTypeObject struct was modified in Python 3.8, this change is +required to avoid compile errors. +--- + .../PythonInterpreter/vtkPythonStdStreamCaptureHelper.h | 6 ++++++ + Wrapping/PythonCore/PyVTKMethodDescriptor.cxx | 2 +- + Wrapping/PythonCore/PyVTKNamespace.cxx | 2 +- + Wrapping/PythonCore/PyVTKReference.cxx | 8 ++++---- + Wrapping/PythonCore/PyVTKTemplate.cxx | 2 +- + Wrapping/PythonCore/vtkPythonCompatibility.h | 8 +++++++- + Wrapping/Tools/vtkWrapPythonClass.c | 2 +- + Wrapping/Tools/vtkWrapPythonEnum.c | 2 +- + Wrapping/Tools/vtkWrapPythonType.c | 2 +- + 9 files changed, 23 insertions(+), 11 deletions(-) + +diff --git a/Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h b/Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h +index b1c12c83de..14ccfbe928 100644 +--- a/Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h ++++ b/Utilities/PythonInterpreter/vtkPythonStdStreamCaptureHelper.h +@@ -140,6 +140,12 @@ static PyTypeObject vtkPythonStdStreamCaptureHelperType = { + #if PY_VERSION_HEX >= 0x03040000 + 0, // tp_finalize + #endif ++#if PY_VERSION_HEX >= 0x03080000 ++ 0, // tp_vectorcall ++#if PY_VERSION_HEX < 0x03090000 ++ 0, // tp_print ++#endif ++#endif + }; + + static PyObject* vtkWrite(PyObject* self, PyObject* args) +diff --git a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx +index 2b0d443537..3840038498 100644 +--- a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx ++++ b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx +@@ -186,7 +186,7 @@ PyTypeObject PyVTKMethodDescriptor_Type = { + sizeof(PyMethodDescrObject), // tp_basicsize + 0, // tp_itemsize + PyVTKMethodDescriptor_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_vectorcall_offset + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKNamespace.cxx b/Wrapping/PythonCore/PyVTKNamespace.cxx +index 71ee2a3516..5cf5bfbe6b 100644 +--- a/Wrapping/PythonCore/PyVTKNamespace.cxx ++++ b/Wrapping/PythonCore/PyVTKNamespace.cxx +@@ -49,7 +49,7 @@ PyTypeObject PyVTKNamespace_Type = { + 0, // tp_basicsize + 0, // tp_itemsize + PyVTKNamespace_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_vectorcall_offset + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKReference.cxx b/Wrapping/PythonCore/PyVTKReference.cxx +index 943ac71080..b7104091c0 100644 +--- a/Wrapping/PythonCore/PyVTKReference.cxx ++++ b/Wrapping/PythonCore/PyVTKReference.cxx +@@ -1010,7 +1010,7 @@ PyTypeObject PyVTKReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_vectorcall_offset + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1067,7 +1067,7 @@ PyTypeObject PyVTKNumberReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_vectorcall_offset + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1124,7 +1124,7 @@ PyTypeObject PyVTKStringReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_vectorcall_offset + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1181,7 +1181,7 @@ PyTypeObject PyVTKTupleReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_vectorcall_offset + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKTemplate.cxx b/Wrapping/PythonCore/PyVTKTemplate.cxx +index be200985b3..340fe7953b 100644 +--- a/Wrapping/PythonCore/PyVTKTemplate.cxx ++++ b/Wrapping/PythonCore/PyVTKTemplate.cxx +@@ -268,7 +268,7 @@ PyTypeObject PyVTKTemplate_Type = { + 0, // tp_basicsize + 0, // tp_itemsize + nullptr, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_vectorcall_offset + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/vtkPythonCompatibility.h b/Wrapping/PythonCore/vtkPythonCompatibility.h +index 4a767844a6..be208faeef 100644 +--- a/Wrapping/PythonCore/vtkPythonCompatibility.h ++++ b/Wrapping/PythonCore/vtkPythonCompatibility.h +@@ -64,7 +64,13 @@ + #endif + + // PyTypeObject compatibility +-#if PY_VERSION_HEX >= 0x03040000 ++#if PY_VERSION_HEX >= 0x03090000 ++#define VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED \ ++ 0, 0, 0, 0, ++#elif PY_VERSION_HEX >= 0x03080000 ++#define VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED \ ++ 0, 0, 0, 0, 0, ++#elif PY_VERSION_HEX >= 0x03040000 + #define VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED \ + 0, 0, 0, + #else +diff --git a/Wrapping/Tools/vtkWrapPythonClass.c b/Wrapping/Tools/vtkWrapPythonClass.c +index b1e45f8e80..4d558ea081 100644 +--- a/Wrapping/Tools/vtkWrapPythonClass.c ++++ b/Wrapping/Tools/vtkWrapPythonClass.c +@@ -521,7 +521,7 @@ void vtkWrapPython_GenerateObjectType( + " sizeof(PyVTKObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " PyVTKObject_Delete, // tp_dealloc\n" +- " nullptr, // tp_print\n" ++ " 0, // tp_vectorcall_offset\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" +diff --git a/Wrapping/Tools/vtkWrapPythonEnum.c b/Wrapping/Tools/vtkWrapPythonEnum.c +index b933702242..1249362854 100644 +--- a/Wrapping/Tools/vtkWrapPythonEnum.c ++++ b/Wrapping/Tools/vtkWrapPythonEnum.c +@@ -145,7 +145,7 @@ void vtkWrapPython_GenerateEnumType( + " sizeof(PyIntObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " nullptr, // tp_dealloc\n" +- " nullptr, // tp_print\n" ++ " 0, // tp_vectorcall_offset\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" +diff --git a/Wrapping/Tools/vtkWrapPythonType.c b/Wrapping/Tools/vtkWrapPythonType.c +index 744cb1b9d3..0a1375e541 100644 +--- a/Wrapping/Tools/vtkWrapPythonType.c ++++ b/Wrapping/Tools/vtkWrapPythonType.c +@@ -709,7 +709,7 @@ void vtkWrapPython_GenerateSpecialType( + " sizeof(PyVTKSpecialObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " Py%s_Delete, // tp_dealloc\n" +- " nullptr, // tp_print\n" ++ " 0, // tp_vectorcall_offset\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" +-- +2.21.0 + diff --git a/vtk.changes b/vtk.changes index 1b42948..234606f 100644 --- a/vtk.changes +++ b/vtk.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Wed Mar 11 13:17:49 UTC 2020 - Stefan Brüns + +- Remove -DVTK_PYTHON_SITE_PACKAGES_SUFFIX silently added with the + last change. As it specifies the path relative to the install + prefix, setting it to the absolute python_sitearch is obviously + wrong. As VTK figures out the correct path by itself, it is + completely unnecessary. + +------------------------------------------------------------------- +Tue Mar 10 14:06:37 UTC 2020 - Tomáš Chvátal + +- Add patch to fix building with python 3.8: + * python38.patch + ------------------------------------------------------------------- Tue Jan 28 22:45:34 UTC 2020 - Stefan Brüns diff --git a/vtk.spec b/vtk.spec index bdf881b..8943ba0 100644 --- a/vtk.spec +++ b/vtk.spec @@ -108,6 +108,8 @@ Patch4: bundled_exodusii_add_missing_libpthread.patch Patch5: 0001-Add-libogg-to-IOMovie-target-link-libraries.patch # PATCH-FIX-UPSTREAM -- Compatibility for proj4 5.x and 6.0, https://gitlab.kitware.com/vtk/vtk/issues/17554 Patch6: 0001-Make-code-calling-proj4-compatible-with-proj4-5.0-an.patch +# PATCH-FIX-UPSTREAM -- Support for python3.8 +Patch7: python38.patch BuildRequires: R-base-devel BuildRequires: chrpath BuildRequires: cmake >= 3.4 @@ -349,6 +351,7 @@ languages. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 # Replace relative path ../../../../VTKData with %%{_datadir}/vtkdata # otherwise it will break on symlinks. @@ -399,7 +402,6 @@ export CXXFLAGS="%{optflags}" -DVTK_INSTALL_LIBRARY_DIR:PATH=%{_lib} \ -DVTK_INSTALL_PACKAGE_DIR:PATH=%{_lib}/cmake/%{pkgname} \ -DVTK_INSTALL_QT_DIR:STRING=%{_lib}/qt5/plugins/designer \ - -DVTK_INSTALL_PYTHON_MODULE_DIR:PATH=%{python3_sitearch} \ -DVTK_PYTHON_VERSION=3 \ -DVTK_QT_VERSION=5 \ -DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON \