# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: lilydjwg <lilydjwg@gmail.com>
pkgname=python-cffi
pkgver=2.0.0
pkgrel=2
pkgdesc="Foreign Function Interface for Python calling C code"
arch=('armv7h' 'aarch64')
url="https://cffi.readthedocs.org/"
license=('MIT')
depends=('python-pycparser')
optdepends=('python-setuptools: "limited api" version checking in cffi.setuptools_ext')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
#checkdepends=('python-pytest')
source=("https://github.com/python-cffi/cffi/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('a71b74e642e11eb50e9bb4ae0e7116bdb3c4a7c9622a3766d84506fa7994c02e09644b41b439b95ca99b0303e91891897cff38018d498eb087e0961f0ad4fb8b')
build() {
cd cffi-$pkgver
# rm pyproject.toml # crude hack to ignore setuptools version check that fails
python -m build -nw
}
#check() {
# cd cffi-$pkgver
# python -m installer --destdir=tmpinstall dist/*.whl
# local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
# PYTHONPATH="$PWD/tmpinstall/usr/lib/python${python_version}/site-packages" pytest
#}
package() {
cd cffi-$pkgver
# remove files created during check() for reproducible SOURCES.txt
rm -fr testing/cffi{0,1}/__pycache__/
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}