# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=pycparser
pkgname=python-pycparser
pkgver=3.0
pkgrel=1
pkgdesc='C parser and AST generator written in Python'
url='https://github.com/eliben/pycparser'
msys2_references=(
  'archlinux: python-pycparser'
  'cygwin: python-pycparser'
  'gentoo: dev-python/pycparser'
  'purl: pkg:pypi/pycparser'
)
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools')
arch=('any')
license=('spdx:BSD-3-Clause')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29')

build() {
  cd "${_realname}-${pkgver}"

  python -m build --wheel --no-isolation --skip-dependency-check
}

package() {
  cd "${_realname}-${pkgver}"

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