Bug#946758: python3-paraview: should be built against all supported Python3 versions

Gilles Filippini pini at debian.org
Sun Dec 15 11:26:15 GMT 2019


Package: python3-paraview
Version: 5.7.0-3
Severity: important
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

The recent upload of paraview release 5.7.0-3 was to fix a Python3 version
related FTBFS:
> paraview (5.7.0-3) unstable; urgency=medium
> 
>   * Hard-code Build-Dep on python3.8-dev. This wasn't being pulled in correctly
>     leading to FTBFS.

Instead of depending on a hardcoded Python3 version, the correct fix should be
to build against every supported Python3 version. This way it won't FTBFS on
the next change in the supported Python3 version list.

Please find attached a patch proposal.

Thanks,

_g.

- -- System Information:
Debian Release: buster/sid
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.3.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEoJObzArDE05WtIyR7+hsbH/+z4MFAl32GE0ACgkQ7+hsbH/+
z4NNMAgArSZaoxbnMR1SfK12zy/VI84L46qYaUCGFKnGqmz/q4Zdoc+pHvmbzDGX
Ac9G+AVPvfT02+aTHP7F+xOC/nZ1ltN7sgkgGaz8hNVgGbi/8U4ZvvB6JJ5tZxh0
jqfAMAOgkzrnH/xv5twB9I2K7GvHnwbDYYp2mQ2tZWpfsJQctHcK6HZjjbdQWBhN
RF9FoVV2uO5K8M7TFyzZdfgyOknrTtxkS5FdG5RUrGdlErfpTe6SH5GKP5+62GSo
SL4J6H8ApYDCxHyg/OqjvCXwdxyhM9L/cJghp4bmGxvbNNSxkB1Qqzl9RBQKKiYV
xaOiI7/F+BDcYDZfX0+fP6wFPNMOeg==
=UzEf
-----END PGP SIGNATURE-----
-------------- next part --------------
diff -Nru paraview-5.7.0/debian/changelog paraview-5.7.0/debian/changelog
--- paraview-5.7.0/debian/changelog	2019-12-11 10:16:00.000000000 +0100
+++ paraview-5.7.0/debian/changelog	2019-12-13 19:25:32.000000000 +0100
@@ -1,3 +1,10 @@
+paraview (5.7.0-4) UNRELEASED; urgency=medium
+
+  * Build for all supported Python3 versions
+  * New patches: python3-exact.patch, python3-exec-versions.patch
+
+ -- Gilles Filippini <pini at debian.org>  Fri, 13 Dec 2019 19:25:32 +0100
+
 paraview (5.7.0-3) unstable; urgency=medium
 
   * Hard-code Build-Dep on python3.8-dev. This wasn't being pulled in correctly
diff -Nru paraview-5.7.0/debian/control paraview-5.7.0/debian/control
--- paraview-5.7.0/debian/control	2019-12-11 10:16:00.000000000 +0100
+++ paraview-5.7.0/debian/control	2019-12-13 19:25:32.000000000 +0100
@@ -27,7 +27,7 @@
                libavcodec-dev,
                libswscale-dev,
                libqt5sql5-sqlite,
-               python3.8-dev,
+               python3-all-dev,
                dh-python,
                libglu1-mesa-dev,
                libxt-dev,
diff -Nru paraview-5.7.0/debian/patches/python3-exact.patch paraview-5.7.0/debian/patches/python3-exact.patch
--- paraview-5.7.0/debian/patches/python3-exact.patch	1970-01-01 01:00:00.000000000 +0100
+++ paraview-5.7.0/debian/patches/python3-exact.patch	2019-12-13 19:25:32.000000000 +0100
@@ -0,0 +1,42 @@
+Description: Makes cmake request the exact python3 version referenced
+ by variable DEBIAN_PYTHON_PYTHON. This allows building for several
+ python3 versions.
+Index: paraview-5.7.0/VTK/CMake/vtkModule.cmake
+===================================================================
+--- paraview-5.7.0.orig/VTK/CMake/vtkModule.cmake
++++ paraview-5.7.0/VTK/CMake/vtkModule.cmake
+@@ -3643,6 +3643,9 @@ macro (vtk_module_find_package)
+         "The `FORWARD_VERSION_REQ` argument must be one of `MAJOR`, `MINOR`, "
+         "`PATCH`, or `EXACT`.")
+     endif ()
++    if (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "EXACT")
++      set(_vtk_find_module_exact_option EXACT)
++    endif ()
+   endif ()
+ 
+   if (NOT DEFINED _vtk_find_package_VERSION_VAR)
+@@ -3656,7 +3659,7 @@ macro (vtk_module_find_package)
+   endif ()
+ 
+   find_package("${_vtk_find_package_PACKAGE}"
+-    ${_vtk_find_package_VERSION}
++    ${_vtk_find_package_VERSION} ${_vtk_find_module_exact_option}
+     ${_vtk_find_package_config}
+     COMPONENTS          ${_vtk_find_package_COMPONENTS}
+     OPTIONAL_COMPONENTS ${_vtk_find_package_OPTIONAL_COMPONENTS})
+Index: paraview-5.7.0/VTK/Utilities/Python/CMakeLists.txt
+===================================================================
+--- paraview-5.7.0.orig/VTK/Utilities/Python/CMakeLists.txt
++++ paraview-5.7.0/VTK/Utilities/Python/CMakeLists.txt
+@@ -43,9 +43,9 @@ elseif (VTK_PYTHON_VERSION STREQUAL "3")
+   endif ()
+   vtk_module_find_package(
+     PACKAGE Python3
+-    VERSION "${vtk_python_min_version}"
++    VERSION "${DEBIAN_PYTHON_VERSION}"
+     COMPONENTS Development
+-    FORWARD_VERSION_REQ MINOR)
++    FORWARD_VERSION_REQ EXACT)
+ else ()
+   message(FATAL_ERROR
+     "`VTK_PYTHON_VERSION` must either be 2 or 3.")
diff -Nru paraview-5.7.0/debian/patches/python3-exec-versions.patch paraview-5.7.0/debian/patches/python3-exec-versions.patch
--- paraview-5.7.0/debian/patches/python3-exec-versions.patch	1970-01-01 01:00:00.000000000 +0100
+++ paraview-5.7.0/debian/patches/python3-exec-versions.patch	2019-12-13 19:25:32.000000000 +0100
@@ -0,0 +1,18 @@
+Description: Name the python related executables after the python3
+ version they were built for
+Index: paraview-5.7.0/CommandLineExecutables/CMakeLists.txt
+===================================================================
+--- paraview-5.7.0.orig/CommandLineExecutables/CMakeLists.txt
++++ paraview-5.7.0/CommandLineExecutables/CMakeLists.txt
+@@ -56,9 +56,9 @@ endforeach ()
+ 
+ if (PARAVIEW_ENABLE_PYTHON)
+   foreach (exe IN ITEMS pvbatch pvpython)
+-    paraview_add_executable("${exe}" "${exe}.cxx")
++    paraview_add_executable("${exe}${DEBIAN_PYTHON_VERSION}" "${exe}.cxx")
+     list(APPEND paraview_tools
+-      "${exe}")
++      "${exe}${DEBIAN_PYTHON_VERSION}")
+   endforeach ()
+ endif ()
+ 
diff -Nru paraview-5.7.0/debian/patches/series paraview-5.7.0/debian/patches/series
--- paraview-5.7.0/debian/patches/series	2019-12-11 10:16:00.000000000 +0100
+++ paraview-5.7.0/debian/patches/series	2019-12-13 19:25:32.000000000 +0100
@@ -2,3 +2,5 @@
 security-format.patch
 override-fix.patch
 python3.8.patch
+python3-exact.patch
+python3-exec-versions.patch
diff -Nru paraview-5.7.0/debian/python3-paraview.install paraview-5.7.0/debian/python3-paraview.install
--- paraview-5.7.0/debian/python3-paraview.install	2019-12-11 10:16:00.000000000 +0100
+++ paraview-5.7.0/debian/python3-paraview.install	2019-12-13 19:25:32.000000000 +0100
@@ -1,2 +1,3 @@
 usr/bin/pvpython
 usr/lib/*/vtk
+usr/lib/python3*
diff -Nru paraview-5.7.0/debian/python3-paraview.pyinstall paraview-5.7.0/debian/python3-paraview.pyinstall
--- paraview-5.7.0/debian/python3-paraview.pyinstall	2019-12-11 10:16:00.000000000 +0100
+++ paraview-5.7.0/debian/python3-paraview.pyinstall	1970-01-01 01:00:00.000000000 +0100
@@ -1,27 +0,0 @@
-# paraview  vtkmodules  vtk.py
-debian/tmp/usr/lib/*/python3*/site-packages/vtk.py vtk
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/*.py paraview
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/demos/*.py paraview.demos
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/detail/*.py paraview.detail
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/benchmark/*.py paraview.benchmark
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/modules/*.py paraview.modules
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/util/*.py paraview.util
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/tpl/*.py paraview.tpl
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/tpl/cinema_python/*.py paraview.tpl.cinema_python
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/tpl/cinema_python/database/*.py paraview.tpl.cinema_python.database
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/tpl/cinema_python/images/*.py paraview.tpl.cinema_python.images
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/tpl/cinema_python/adaptors/*.py paraview.tpl.cinema_python.adaptors
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/tpl/cinema_python/adaptors/paraview/*.py paraview.tpl.cinema_python.adaptors.paraview
-#debian/tmp/usr/lib/*/python3*/site-packages/paraview/vtk/*.py paraview.vtk
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/modules/*.py paraview.modules
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/*.py vtkmodules
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/gtk/*.py vtkmodules.gtk
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/tk/*.py vtkmodules.tk
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/qt/*.py vtkmodules.qt
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/wx/*.py vtkmodules.wx
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/test/*.py vtkmodules.test
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/util/*.py vtkmodules.util
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/numpy_interface/*.py vtkmodules.numpy_interface
-# modules
-debian/tmp/usr/lib/*/python3*/site-packages/paraview/modules/*.so paraview.modules
-debian/tmp/usr/lib/*/python3*/site-packages/vtkmodules/*.so vtkmodules
diff -Nru paraview-5.7.0/debian/rules paraview-5.7.0/debian/rules
--- paraview-5.7.0/debian/rules	2019-12-11 10:16:00.000000000 +0100
+++ paraview-5.7.0/debian/rules	2019-12-13 19:25:32.000000000 +0100
@@ -5,7 +5,10 @@
 UPSTREAM_VERSION = $(shell dpkg-parsechangelog | awk '/^Version:/ { sub("-[^-]*$$", "", $$2); print $$2}')
 
 %:
-	dh $@ --buildsystem=cmake --with python3
+	dh $@ --buildsystem=cmake --with python3 --parallel
+
+PY3VERS=$(shell py3versions -vr)
+PY3DEF=$(shell py3versions -dv)
 
 export LD_LIBRARY_PATH+=:$(CURDIR)/debian/paraview/usr/lib/paraview
 export QT_SELECT=qt5
@@ -75,8 +78,37 @@
 	-DPARAVIEW_ENABLE_MOTIONFX=ON \
 	-DPARAVIEW_PLUGIN_ENABLE_EyeDomeLighting=ON 
 
-override_dh_auto_configure:
-	dh_auto_configure -- $(extra_flags)
+override_dh_auto_clean:
+	dh_auto_clean
+	rm -fr build.*
+
+my_configure_python%: pyver=$(patsubst my_configure_python%,%,$@)
+my_configure_python%:
+	dh_auto_configure -Bbuild.python$(pyver) -- $(extra_flags) -DPython3_EXECUTABLE=/usr/bin/python$(pyver) -DDEBIAN_PYTHON_VERSION=$(pyver)
+
+override_dh_auto_configure: $(foreach pyver,$(PY3VERS), my_configure_python$(pyver))
+
+my_build_python%: pyver=$(patsubst my_build_python%,%,$@)
+my_build_python%:
+	dh_auto_build -Bbuild.python$(pyver)
+
+override_dh_auto_build: $(foreach pyver,$(PY3VERS), my_build_python$(pyver))
+
+my_install_python%: pyver=$(patsubst my_install_python%,%,$@)
+my_install_python%:
+	dh_auto_install -Bbuild.python$(pyver)
+
+override_dh_auto_install: $(foreach pyver,$(PY3VERS), my_install_python$(pyver))
+	# Use the defaut python3 version for the tools
+	cd debian/tmp/usr/bin $(foreach exe,pvbatch pvpython,&& mv $(exe)$(PY3DEF) $(exe))
+	# Move out python3 modules from archtriplet subfolder to have correct behavior from dh_python3
+	mv debian/tmp/usr/lib/*/python3* debian/tmp/usr/lib/
+
+my_test_python%: pyver=$(patsubst my_test_python%,%,$@)
+my_test_python%:
+	dh_auto_test -Bbuild.python$(pyver)
+
+override_dh_auto_test: $(foreach pyver,$(PY3VERS), my_test_python$(pyver))
 
 override_dh_compress:
 	dh_compress -X.qch


More information about the debian-science-maintainers mailing list