# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-ovos-ocp-audio-plugin
pkgver=0.0.6_alpha2
pkgrel=3
pkgdesc="A full-fledged voice media player packaged as a Mycroft audio plugin"
url="https://github.com/OpenVoiceOS/ovos-ocp-audio-plugin"
arch="noarch"
license="Apache-2.0"
depends="
	py3-dbus-next
	py3-ovos-audio-plugin-simple
	py3-ovos-backend-client
	py3-ovos-bus-client
	py3-ovos-lingua-franca
	py3-ovos-ocp-files-plugin
	py3-ovos-plugin-manager
	py3-ovos-workshop
	py3-padacioso
	"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenVoiceOS/ovos-ocp-audio-plugin/archive/refs/tags/V${pkgver//_alpha/a}.tar.gz"
# Hangs on collecting tests
options="!check"
builddir="$srcdir/ovos-ocp-audio-plugin-${pkgver//_alpha/a}"

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# test/unittests/test_media_intents.py is failing
	# Ignored test have a dependency on mycroft (provided by ovos-core), causing a circular dependency
	.testenv/bin/python3 -m pytest \
		--ignore test/unittests/test_audio_backends.py \
		--ignore test/unittests/test_external_ocp.py \
		--ignore test/unittests/test_mycroft.py \
		--ignore test/unittests/test_mycroft_bus_api.py \
		--ignore test/unittests/test_media_intents.py
}

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

sha512sums="
90eb290c4c16cd471e12fc3431ea5229e4a0db909b782cc855cca223e47a3ba44ca90e0a86cc03f3b978803b3b3546bb370bdb9667ab91b5e3e5bc82f6b11998  py3-ovos-ocp-audio-plugin-0.0.6_alpha2.tar.gz
"
