# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>

pkgname=py3-rpy2
_pyname="rpy2"
pkgver=3.5.14
pkgrel=0
# riscv64: R missing
arch="all !riscv64"
pkgdesc="A very simple, yet robust, Python interface to the R Programming Language"
url="https://pypi.python.org/project/$_pyname"
license="GPL-2.0-only"
depends="
	py3-cffi
	py3-numpy
	py3-tz
	py3-tzlocal
	py3-jinja2
	R
	"
makedepends="
	py3-build
	py3-installer
	py3-setuptools
	py3-wheel
	python3-dev
	R-dev
	"
checkdepends="
	py3-pytest
	"
options="!check" # test failures due to missing R packages
source="$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/${_pyname:0:1}/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir"/$_pyname-$pkgver
subpackages="$pkgname-pyc"

build() {
	python3 -m build --wheel --no-isolation
}

check() {
	PYTHONPATH="$PWD"/$(echo build/lib.*) \
	pytest -v -k 'not test_rendertofile and not test_rendertobytes_plot' # Skip test that segfaults in build server
}

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

sha512sums="
d02454fb41c946a0a92547f8a5dba3c614741bec8e293984116b34dfbe97574a655b7066fd75d34fee4c0f604c41c8b672d6a2c3b4194cba30a37c95da6578dd  py3-rpy2-3.5.14.tar.gz
"