Name python-cffi
Description Foreign Function Interface for Python calling C code
Version 2.0.0-2
Package Base python-cffi
Homepage https://cffi.readthedocs.org/
Maintainers ['Felix Yan <felixonmars@archlinux.org>', 'Jelle van der Waa <jelle@archlinux.org>']
Contributors ['lilydjwg <lilydjwg@gmail.com>']
Distro-repo https://gitlab.archlinux.org/archlinux/packaging/packages/python-cffi
Sources ['https://github.com/python-cffi/cffi/archive/v2.0.0/python-cffi-2.0.0.tar.gz']
Dependencies ['python-pycparser']
Optional-Dependencies ['python-setuptools']
Build-Dependencies ['python-build', 'python-installer', 'python-setuptools', 'python-wheel']
Provides []
Builddate 14-12-2025 12:48:00
Architecture x86_64
Distro-Version
Licenses ['MIT']
Hash dc0c2f3f54e54f9bdfcaf7bdd18a52c230abcd09d36906269bc832ecab2e586c
# 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=('x86_64')
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
  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 -rf testing/cffi{0,1}/__pycache__/

  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}