maintainer="Bart Ribbers <bribbers@disroot.org>"
pkgname=ovos-core
pkgver=1.3.1
pkgrel=0
pkgdesc="OVOS Core, the OVOS Artificial Intelligence platform"
url="https://github.com/OpenVoiceOS/ovos-core/"
arch="noarch"
license="Apache-2.0"
depends="
	py3-adapt-parser
	py3-combo-lock
	py3-dateutil
	py3-ovos-backend-client
	py3-ovos-bus-client
	py3-ovos-classifiers
	py3-ovos-config
	py3-ovos-lingua-franca
	py3-ovos-plugin-manager
	py3-ovos-translate-server-plugin
	py3-ovos-utils
	py3-ovos-workshop
	py3-padatious
	py3-requests
	py3-watchdog
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenVoiceOS/ovos-core/archive/refs/tags/${pkgver//_alpha/a}.tar.gz
	profile.sh
	ovos.conf
	"
builddir=$srcdir/ovos-core-${pkgver//_alpha/a}
# Net is required for tests
# Some tests are broken still, will be enabled later
options="!check"

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

check() {
	# test_hotword_factory and test_local_recognizer fail
	# https://github.com/MycroftAI/mycroft-core/issues/2574
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

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

	install -Dm644 -t "$pkgdir"/etc/OpenVoiceOS "$srcdir"/ovos.conf

	install -Dm644 "$srcdir"/profile.sh "$pkgdir"/etc/profile.d/ovos.sh
}
sha512sums="
47dbf5ec83a926ec7de79cb2b6f0ef95b8c08fe1ba6ccec8fab309f2315f136693e6407006aac469b333e8b9d2e3cedb8c7cdabf03975bb2142dfaabdd2a2795  ovos-core-1.3.1.tar.gz
c3d1a605a0b574c8e2c4031f592bdbf023f5ed9b2e1ba0cea38cf79278331f245dbe4e220e7f81de73fe612ffd722253805058dae04ba89c3d01c361b329e4ef  profile.sh
889b668be450db9c27d7d9f3b00bbcd9a2882f8a4c129cdc5c94ab21490e85acddfd914496447f5f011713c2ecd5b1cafbf13a5948677d9ff82eb5e478faf47a  ovos.conf
"
