# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Samuel Littley <aur@toastwaffle.com>
# Contributor: rnons <remotenonsense at gmail dot com>

_pkg=ruamel.yaml.clib
pkgname=python-$_pkg
pkgver=0.2.8
pkgrel=2
pkgdesc="C version of reader, parser and emitter for ruamel.yaml derived from libyaml"
arch=('x86_64' 'aarch64')
url="https://sourceforge.net/projects/ruamel-yaml-clib/"
license=('MIT')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=(https://files.pythonhosted.org/packages/source/r/${_pkg}/${_pkg}-${pkgver}.tar.gz)
sha512sums=('1984d1f46f9d98c178315d1aad27d02fe3a228fbe4a2f4e68729b850c1ebe08ff0ef2fab38841296a2ac0a1f8a0bf7231ab8d7972a9a39a260ea773457f1393b')

build() {
  cd ${_pkg}-${pkgver}
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd ${_pkg}-${pkgver}
  python -m installer --destdir="${pkgdir}" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "${pkgdir}"/usr/share/licenses/"${pkgname}"
  ln -s "${site_packages}"/${_pkg}-${pkgver}.dist-info/LICENSE \
    "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
}
