# Contributor: Corentin Henry <corentinhenry@gmail.com>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-protobuf
pkgver=5.29.4
_protobuf=${pkgver#*.}
pkgrel=0
pkgdesc="Google's data interchange format"
url="https://github.com/protocolbuffers/protobuf"
arch="all"
license="BSD-3-Clause"
depends="tzdata"
makedepends="protobuf-dev python3-dev py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-numpy"
# NOTE: Always use pypi releases of protobuf, not GitHub releases or auto-generated GitHub
# tarballs as it is not possible to build from setup.py with these sources.
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/protobuf/protobuf-$pkgver.tar.gz"
builddir="$srcdir"/protobuf-$pkgver
options="!check" # seem to not generate some test protos

replaces="py-protobuf" # Backwards compatibility
provides="py-protobuf=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	pytest
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"

	# correct permissions
	chmod +r "$pkgdir"/usr/lib/*/site-packages/*/*
}

sha512sums="
634faf103ed8320762593689796d26e6b988e1b40277b12dc7356983c07d5d1da8cac1530e4f16c0a1494abfb885f26bf9884988029e863515cf535c62d96c77  protobuf-5.29.4.tar.gz
"
