# Template file for 'python-pyzbar'
pkgname=python-pyzbar
version=0.1.8
revision=2
archs=noarch
wrksrc="pyzbar-${version}"
build_style=python-module
pycompile_module="pyzbar"
hostmakedepends="python-setuptools python3-setuptools"
depends="libzbar python-enum34 python-pathlib"
short_desc="Read one-dimensional barcodes and QR codes"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="MIT"
homepage="https://github.com/NaturalHistoryMuseum/pyzbar/"
distfiles="https://github.com/NaturalHistoryMuseum/pyzbar/archive/v${version}.tar.gz"
checksum=f51c82c2864f8e5a8d44f55853e027f8cbc592324b7afffa62100f2f9c54cbdb
alternatives="pyzbar:read_zbar:/usr/bin/read_zbar.py2"

post_install() {
	vlicense LICENSE.txt
	# These only exec read_zbar.py{2,3}
	rm "$DESTDIR"/usr/bin/read_zbar{2,3}
}

python3-pyzbar_package() {
	archs=noarch
	pycompile_module="pyzbar"
	depends="libzbar python3"
	alternatives="pyzbar:read_zbar:/usr/bin/read_zbar.py3"
	pkg_install() {
		vlicense LICENSE.txt
		vmove usr/lib/python3*
		vmove usr/bin/read_zbar.py3
	}
}
