AUR package: Can't test v2.0.0
Hey!
I'm trying to update the AUR package to v2.0.0, but I'm getting an import error when I run the package's test suite:
============================================================================================ test session starts ============================================================================================
platform linux -- Python 3.13.7, pytest-8.4.2, pluggy-1.6.0
rootdir: /home/mrpaur/packages/python-mapbox-earcut/src/mapbox_earcut_python-2.0.0
configfile: pyproject.toml
collected 0 items / 2 errors
================================================================================================== ERRORS ===================================================================================================
___________________________________________________________________________________ ERROR collecting tests/test_earcut.py ___________________________________________________________________________________
ImportError while importing test module '/home/mrpaur/packages/python-mapbox-earcut/src/mapbox_earcut_python-2.0.0/tests/test_earcut.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_earcut.py:1: in <module>
import mapbox_earcut as earcut
mapbox_earcut/__init__.py:8: in <module>
from ._core import (
E ModuleNotFoundError: No module named 'mapbox_earcut._core'
________________________________________________________________________________ ERROR collecting tests/test_threadsafety.py ________________________________________________________________________________
ImportError while importing test module '/home/mrpaur/packages/python-mapbox-earcut/src/mapbox_earcut_python-2.0.0/tests/test_threadsafety.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_threadsafety.py:13: in <module>
import mapbox_earcut as earcut
mapbox_earcut/__init__.py:8: in <module>
from ._core import (
E ModuleNotFoundError: No module named 'mapbox_earcut._core'
========================================================================================== short test summary info ==========================================================================================
ERROR tests/test_earcut.py
ERROR tests/test_threadsafety.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================= 2 errors in 0.09s =============================================================================================
As the tests run in the user's computer right before installing the package, this failure means that they would be installing a broken package in their system, so the installation must abort. Do you know what may be causing this issue? I'm honestly at a loss here, as it seems to come from the C++ bindings but I've never used them :-(
For reference, here's the PKGBUILD file at its current, failing state:
# Maintainer: Groctel <[email protected]>
# shellcheck disable=SC1091,SC2034,SC2154,SC2164
_name=mapbox_earcut_python
pkgname=python-mapbox-earcut
pkgver=2.0.0
pkgrel=1
pkgdesc="Python bindings for the C++ implementation of the Mapbox Earcut library."
arch=("x86_64")
license=("ISC")
url="https://github.com/skogler/mapbox_earcut_python"
source=("$url/archive/refs/tags/v$pkgver.tar.gz")
sha512sums=('e673b89e16a2007085e6e036b32867bdcdf984b3dec3bf93182ad352b36d6bf3ae4f750de136a9833b3328241fdf725b4f11c4981f9334a9a27e1b4077af1cea')
depends=(
"gcc-libs"
"glibc"
"python"
)
makedepends=(
"nanobind"
"python-build"
"python-installer"
"python-scikit-build-core"
"python-setuptools"
"python-wheel"
)
checkdepends=(
"python-numpy"
"python-pytest"
"python-virtualenv"
)
build () {
cd "$srcdir/$_name-$pkgver"
python -m build --wheel --no-isolation
}
check () {
cd "$srcdir/$_name-$pkgver"
python -m venv --system-site-packages venv
source venv/bin/activate
pip install ./dist/*.whl
python -m pytest
rm -rf venv
}
package () {
cd "$srcdir/$_name-$pkgver"
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Thank you for your time and work :-)
Hey @Groctel
thats a name clash issue since you are running pytest from a dir where there is already a subdir called mapbox_earcut.
If you cd to the tests directory before, it works as expected:
# Maintainer: Groctel <[email protected]>
# shellcheck disable=SC1091,SC2034,SC2154,SC2164
_name=mapbox_earcut_python
pkgname=python-mapbox-earcut
pkgver=2.0.0
pkgrel=1
pkgdesc="Python bindings for the C++ implementation of the Mapbox Earcut library."
arch=("x86_64")
license=("ISC")
url="https://github.com/skogler/mapbox_earcut_python"
source=("$url/archive/refs/tags/v$pkgver.tar.gz")
sha512sums=('e673b89e16a2007085e6e036b32867bdcdf984b3dec3bf93182ad352b36d6bf3ae4f750de136a9833b3328241fdf725b4f11c4981f9334a9a27e1b4077af1cea')
depends=(
"gcc-libs"
"glibc"
"python"
)
makedepends=(
"nanobind"
"uv"
)
checkdepends=(
"python-numpy"
"python-pytest"
"python-virtualenv"
)
build() {
cd "$srcdir/$_name-$pkgver"
python -m build --wheel
}
check() {
cd "$srcdir/$_name-$pkgver"
python -m venv --system-site-packages venv
source venv/bin/activate
pip install numpy ./dist/*.whl
pushd tests
python -m pytest
popd
rm -rf venv
}
package() {
cd "$srcdir/$_name-$pkgver"
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Also took me a while to figure out though ;-)