Date: Saturday, January 14, 2023 @ 00:36:12
Author: dvzrv
Revision: 1383317
upgpkg: mayavi 4.8.1-2: Rebuild to fix hardcoding of python version and other
issues.
Remove hardcoding of python version.
Switch to PEP517.
Run (some) tests in check.
Remove unneeded modifications.
Modified:
mayavi/trunk/PKGBUILD
----------+
PKGBUILD | 147 ++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 79 insertions(+), 68 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2023-01-13 23:29:49 UTC (rev 1383316)
+++ PKGBUILD 2023-01-14 00:36:12 UTC (rev 1383317)
@@ -3,103 +3,114 @@
pkgname=mayavi
pkgver=4.8.1
-pkgrel=1
+pkgrel=2
pkgdesc="A 3-dimensional visualizer of scientific data"
arch=('x86_64')
url="https://github.com/enthought/mayavi"
license=('BSD')
-depends=('vtk' 'python-envisage' 'python-traitsui' 'python-configobj'
'python-pyqt5' 'pdal' 'unixodbc' 'pugixml' 'openmpi' 'ffmpeg' 'python-numpy'
- 'fmt' 'ospray' 'openvr' 'liblas' 'cgns' 'adios2' 'libharu' 'gl2ps'
'postgresql-libs' 'netcdf' 'mariadb-libs')
-makedepends=('python-setuptools' 'python-sphinx' 'python-twisted'
'xorg-server-xvfb' 'qt5-svg' 'glew' 'proj')
+depends=(
+ 'adios2'
+ 'cgns'
+ 'ffmpeg'
+ 'fmt'
+ 'gl2ps'
+ 'libharu'
+ 'liblas'
+ 'mariadb-libs'
+ 'netcdf'
+ 'openmpi'
+ 'openvr'
+ 'ospray'
+ 'pdal'
+ 'postgresql-libs'
+ 'pugixml'
+ 'python-apptools'
+ 'python-configobj' # python-apptools optdepends
+ 'python-envisage'
+ 'python-numpy'
+ 'python-packaging'
+ 'python-pygments'
+ 'python-pyqt5'
+ 'python-setuptools' # required for version check
+ 'python-traits'
+ 'python-traitsui'
+ 'unixodbc'
+ 'vtk'
+)
+makedepends=(
+ 'glew'
+ 'python-build'
+ 'python-installer'
+ 'python-wheel'
+)
+checkdepends=(
+ 'python-pillow'
+ 'python-pytest'
+)
replaces=('python-mayavi')
provides=('python-mayavi')
options=(!emptydirs)
-source=("$pkgname-$pkgver.tar.gz::https://github.com/enthought/mayavi/archive/${pkgver}.tar.gz"
- "disable-openvdb-and-openvr.patch"
- "mayavi.sh" "mayavi.csh")
+source=(
+
"$pkgname-$pkgver.tar.gz::https://github.com/enthought/mayavi/archive/${pkgver}.tar.gz"
+ "disable-openvdb-and-openvr.patch"
+ "mayavi.sh"
+ "mayavi.csh"
+)
sha256sums=('903dc4fe340ddfbb5245b3da92d244912b36f2043aaeea938788689fb965cb1c'
'4f9eb2bfd3d610c70949ffc6a5e5eb2cf8fa217a6674c91271f7defc22a1add2'
'abb34e78105abf15197bdd05c02ba3b080755d46aa81e4cfaeaba4994d05effe'
'034b36bf9d279d926c39c858bf18992e34de880725d778f8435b293259f4775d')
+b2sums=('4001a4fb109e64989a3788209fbb719eeda4fae5665240e017f56448369fe627e12d6c80b81c7c00e50752d43abc24656e2aa8ff80c5eebd39ee55fa6d30767e'
+
'817b4c7d0db203527f8c092607f566be37d96ddd385de6b119bb91cfa697caf13d0bbedfbad1ff829f99b326bd2bc45b6163f01f95d0814a3c379311a4a2af0a'
+
'9fc7b1d4e448c0f926e7bf146857f9d082a4ddcdfe67a34911c07355811d3850986552bf95f8b726de5ec7ed2d3d3e611fa7429d05c3d7baf6dfba65920c410f'
+
'bc6a6f5ea58beba806564c52ac77cb9fff51a8cf6b0428cf10225054283bfefacaf00a46811f8cab73f8ba27d1e88cc063913908317c402c25fd6efb1e947e18')
prepare() {
- cd "$srcdir"/mayavi-$pkgver
+ cd $pkgname-$pkgver
+ # remove unresolvable build requirements
+ sed -e '/vtk/d; /numpy/d' -i pyproject.toml
+ # remove unresolvable runtime requirements
+ sed -e '/vtk/d' -i $pkgname/__init__.py
+
# skip vtk 9.1.0 classes which cause segfaults
patch -Np1 -i ../disable-openvdb-and-openvr.patch
-
- # fix wrong-file-end-of-line-encoding
- for file in *.txt examples/mayavi/data/room_vis.wrl examples/tvtk/dscene.py \
- examples/mayavi/interactive/wx_mayavi_embed*.py ; do
- sed "s|\r||g" $file > $file.new && \
- touch -r $file $file.new && \
- mv $file.new $file
- done
-
- # file-not-utf8
- for file in *.txt docs/*.txt; do
- iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
- touch -r $file $file.new && \
- mv $file.new $file
- done
-
- # remove exec permission
- find examples -type f -exec chmod 0644 {} ";"
- chmod 0644 mayavi/tests/data/cellsnd.ascii.inp
-
- # set path so autodoc can find just built modules
- echo "import sys" >> docs/source/mayavi/conf.py
- echo
"sys.path.append('$srcdir/mayavi-$pkgver/build/lib.linux-$CARCH-3.10/')" >>
docs/source/mayavi/conf.py
}
build() {
- cd "$srcdir"/mayavi-$pkgver
+ cd $pkgname-$pkgver
- rm -rf build
- mkdir build
- mkdir -p
build/lib.linux-$CARCH-3.10/{tvtk/plugins/scene,mayavi/preferences,mayavi/core}
- ln -s "$srcdir"/enthought-mayavi-${_githubtag}/tvtk/tvtk_classes.zip \
- build/lib.linux-$CARCH-3.10/tvtk/tvtk_classes.zip
- ln -s
"$srcdir"/enthought-mayavi-${_githubtag}/mayavi/preferences/preferences.ini \
- build/lib.linux-$CARCH-3.10/mayavi/preferences/preferences.ini
- ln -s
"$srcdir"/enthought-mayavi-${_githubtag}/tvtk/plugins/scene/preferences.ini \
- build/lib.linux-$CARCH-3.10/tvtk/plugins/scene/preferences.ini
+ python -m build --wheel --no-isolation
+}
- export ETS_TOOLKIT="qt"
- export LANG=C
- # now this is ugly, but docs do not build without X. We setup X according to:
- #
http://docs.enthought.com/mayavi/mayavi/tips.html#rendering-using-the-virtual-framebuffer
- xvfb-run python setup.py build
+check() {
+ local site_packages=$(python -c "import site;
print(site.getsitepackages()[0])")
- rm build/lib.linux-$CARCH-3.10/tvtk/tvtk_classes.zip
- rm build/lib.linux-$CARCH-3.10/mayavi/preferences/preferences.ini
- rm build/lib.linux-$CARCH-3.10/tvtk/plugins/scene/preferences.ini
+ cd $pkgname-$pkgver
+ # install to temporary location, as importlib is used
+ python -m installer --destdir=test_dir dist/*.whl
+ export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
+ export ETS_TOOLKIT=null
+ pytest -vv $pkgname/
+ # NOTE: skipping tests for tvtk, since we are not building vtk 9.1.0 classes
+ # pytest -vv tvtk/
}
package() {
- cd "$srcdir"/mayavi-$pkgver
+ local site_packages=$(python -c "import site;
print(site.getsitepackages()[0])")
- python setup.py install --skip-build --root="$pkgdir"/ --optimize=1
+ cd $pkgname-$pkgver
- # remove useless files
- rm -f "${pkgdir}"/usr/lib/python3.10/site-packages/tvtk/setup.py*
- find "${pkgdir}" -name \.buildinfo -type f -print | xargs rm -f -
+ python -m installer --destdir="$pkgdir" dist/*.whl
+ install -vDm 644 docs/mayavi2.man "$pkgdir"/usr/share/man/man1/mayavi2.1
+ install -vDm 644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
- # non-executable-script
- chmod +x
"${pkgdir}"/usr/lib/python3.10/site-packages/mayavi/tests/runtests.py
-
- # install manpage
- mkdir -p "${pkgdir}"/usr/share/man/man1
- cp -p docs/mayavi2.man "${pkgdir}"/usr/share/man/man1/mayavi2.1
-
# Force Qt
- install -d "${pkgdir}"/etc/profile.d
- install -Dm644 "${srcdir}"/mayavi.sh "${pkgdir}"/etc/profile.d/mayavi.sh
- install -Dm644 "${srcdir}"/mayavi.csh "${pkgdir}"/etc/profile.d/mayavi.csh
+ install -vDm 644 ../mayavi.sh -t "$pkgdir/etc/profile.d/"
+ install -vDm 644 ../mayavi.csh -t "$pkgdir/etc/profile.d/"
- install -D LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
-
- # Cannot find vtk
- sed -i '/vtk/d'
"$pkgdir"/usr/lib/python3.10/site-packages/mayavi-${pkgver}-py3.10.egg-info/requires.txt
+ # remove tests and unneeded files
+ rm -frv "$pkgdir/$site_packages/$pkgname/tests/"
+ rm -frv "$pkgdir/$site_packages/tvtk/"{setup.py,tests/}
}