# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>

_name=pure_eval
pkgname=python-pure-eval
pkgver=0.2.3
pkgrel=2
pkgdesc='Safely evaluate AST nodes without side effects'
arch=(any)
url=https://github.com/alexmojaki/pure_eval
license=(MIT)
depends=(python)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools-scm
  python-wheel
)
checkdepends=(python-pytest)
source=("git+$url.git#tag=v$pkgver")
b2sums=('5cffdd110b19a677bfa655c309fa1afe730b628e2eec13969d9313e1bdd735e99c7df874d2f8d15d37ac46b39cedb5e421d0999a06e1b9e0968a516bbfe3b4cb')

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

check() {
  cd $_name
  PYTHONPATH=$_name pytest
}

package() {
  cd $_name
  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"/$_name-$pkgver.dist-info/LICENSE.txt \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
}
