# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-nikola
_pyname=Nikola
pkgver=8.3.1
pkgrel=0
pkgdesc="Modular, fast, simple, static python website generator"
url="https://getnikola.com"
# armv7, armhf, s390x, x86: py3-piexif
arch="noarch !armv7 !armhf !s390x !x86"
license="MIT"
depends="py3-babel py3-blinker py3-doit py3-dateutil py3-docutils py3-logbook
	py3-lxml py3-mako py3-markdown py3-natsort py3-piexif py3-pillow
	py3-pygments py3-pyphen py3-pyrss2gen py3-requests py3-unidecode py3-yapsy
	"
checkdepends="py3-pytest py3-pytest-cov jupyter-notebook py3-aiohttp
	py3-feedparser py3-freezegun py3-jinja2 py3-phpserialize py3-ruamel.yaml
	py3-toml py3-watchdog
	"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
source="https://files.pythonhosted.org/packages/source/N/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir"/$_pyname-$pkgver

replaces="py-nikola"                  # Backwards compatibility
provides="py-nikola=$pkgver-r$pkgrel" # Backwards compatibility
subpackages="$pkgname-doc $pkgname-pyc"

# Missing jupyter-notebook for checkdepends
case "$CARCH" in
	loongarch64|ppc64le|riscv64) options="$options !check";;
esac

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/tests
}

sha512sums="
cbf4e099e2e1ee22ab16c8a3d3984617097721cb24cf03cf9673fc89d051fa712a05cbbfb522f85d6808155a0fa8835b1630096691a33c25aee8cf24564df050  Nikola-8.3.1.tar.gz
"
