# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=py3-pynvim
_pyname=pynvim
pkgver=0.5.2
pkgrel=0
pkgdesc="python client and plugin host for Nvim"
url="https://github.com/neovim/pynvim"
arch="noarch"
license="Apache-2.0"
depends="neovim py3-msgpack py3-greenlet"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-pytest-timeout"
subpackages="$pkgname-pyc"
# fix-tests.patch
source="$_pyname-$pkgver.tar.gz::https://github.com/neovim/$_pyname/archive/$pkgver.tar.gz
	test-attach-increase-timeout.patch
	"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --system-site-packages testenv
	testenv/bin/python3 -m installer dist/*.whl
	# test_broadcast hangs forever; may be related to https://github.com/neovim/pynvim/commit/cc45f5bd776cb778d0bf68cb5d19aa7aef2f4940
	# try re-selecting once neovim 11 is released.
	testenv/bin/python3 -m pytest \
		--deselect=test/test_events.py::test_broadcast
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/*.whl
}

sha512sums="
3bc07e6e1aec265d9584cb03946a0d72fbd43be498bfcefc35d6b60f23316d1dd0ea812f24d96a0e156bd54918944b3cce6303f9a66b23e61c9a000233aa10eb  pynvim-0.5.2.tar.gz
ab242a33c42e9343cd96c645dc8cbb1a3d79980b994195189ea42e27cdf6de4a432f76d77216b3767d3f3f3cea389333712a406d5f516fa72c27ddf2727dcafc  test-attach-increase-timeout.patch
"
