# 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
pkgname=python-${_pkg/./-}
pkgver=0.18.10
pkgrel=1
pkgdesc="YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order"
arch=('any')
url="https://sourceforge.net/projects/ruamel-yaml/"
license=('MIT')
depends=('python-ruamel.yaml.clib')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=(https://files.pythonhosted.org/packages/source/r/${_pkg}/${_pkg}-${pkgver}.tar.gz)
sha512sums=('fe3c85c55d344f33d4ca7a7b85381258bbd8b6d32249ac93b529dab7d68f84b536c531fcefd77d5c4fec5cab92595896414022ff8a53666de99502d89feaa74a')

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
}
