# Maintainer: Alexandre Ferreira < alex.jorge.m [at] gmail.com >

_pyname=pyyaml
_realname=yaml
pkgbase=python-${_realname}
pkgname=("python-${_realname}")
pkgver=6.0.3
pkgrel=1
pkgdesc='Python bindings for YAML, using fast libYAML library'
arch=('i686' 'x86_64')
url='https://pyyaml.org/'
msys2_references=(
  "anitya: 4123"
  'archlinux: python-yaml'
  "purl: pkg:pypi/pyyaml"
  "cpe: cpe:/a:pyyaml:pyyaml"
)
license=('spdx:MIT')
depends=('python' 'libyaml')
makedepends=(
  'python-build'
  'python-installer'
  'cython'
  'python-setuptools'
  'libyaml-devel'
  'python-devel'
  'gcc'
)
source=("https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
sha256sums=('d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f')

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

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

check() {
  cd "${_pyname}-${pkgver}"

  python setup.py test
}

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

  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/python-${_realname}/COPYING"
  install -Dm644 CHANGES README.md -t "${pkgdir}/usr/share/doc/python-${_realname}"
}
