# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
maintainer="Will Sinatra <wpsinatra@gmail.com>"
pkgname=py3-nltk
_pkgorig=nltk
pkgver=3.9.1
pkgrel=0
pkgdesc="Natural Language Toolkit"
url="https://github.com/nltk/nltk"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-yaml py3-click py3-regex"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-matplotlib py3-numpy py3-pytest py3-pytest-mock"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/nltk/nltk/archive/$pkgver.tar.gz
	fix-import-wordnet.patch
	"
builddir="$srcdir/$_pkgorig-$pkgver"

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
	.testenv/bin/python3 -m nltk.downloader all
	.testenv/bin/python3 -m pytest
}

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

	rm -r "$pkgdir"/usr/lib/python3.*/site-packages/nltk/test
}

sha512sums="
7e384a23fa3839c29d38c083d6288d15ff04eb071c4bca3ec1bfb3b9cfcac8d2388041a950d6c71684ee29b791318312df99e29ae258eb5e602ccf2ad1407840  py3-nltk-3.9.1.tar.gz
9c4491d6ebdaad056b7bd7a3ebe7c720ad47568181aec2a1801b198e1ed81a9174ec2811227d37a336fe689f05afb5ac983fe0d05b3a379aff9bf4cfa87aba69  fix-import-wordnet.patch
"
