# Template file for 'python-cffi'
pkgname=python-cffi
version=1.12.3
revision=2
wrksrc="cffi-${version}"
build_style=python-module
pycompile_module="cffi"
hostmakedepends="python-setuptools python3-setuptools libffi-devel"
makedepends="python-devel python3-devel libffi-devel"
depends="python-pycparser"
checkdepends="python-pytest python3-pytest python-pycparser
 python3-pycparser"
short_desc="C foreign function interface for Python2"
maintainer="Alessio Sergi <al3hex@gmail.com>"
license="MIT"
homepage="https://cffi.readthedocs.io/"
distfiles="${PYPI_SITE}/c/cffi/cffi-${version}.tar.gz"
checksum=041c81822e9f84b1d9c401182e174996f0bae9991f33725d059b771744290774

do_check() {
	python2 setup.py build_ext -i
	python2 -m pytest c/ testing/
	python3 setup.py build_ext -i
	python3 -m pytest c/ testing/
}

post_install() {
	vlicense LICENSE
}

python3-cffi_package() {
	depends="python3-pycparser"
	pycompile_module="cffi"
	short_desc="${short_desc/Python2/Python3}"
	pkg_install() {
		vmove usr/lib/python3*
		vlicense LICENSE
	}
}
