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

_name=stack_data
pkgname=python-stack-data
pkgver=0.6.3
pkgrel=2
pkgdesc='Extract data from python stack frames and tracebacks for informative displays'
arch=(any)
url=https://github.com/alexmojaki/stack_data
license=('MIT')
depends=('python-asttokens' 'python-executing' 'python-pure-eval')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools-scm'
  'python-wheel'
)
checkdepends=(
  'cython'
  'python-littleutils'
  'python-pygments'
  'python-pytest'
  'python-typeguard'
)
source=("git+$url.git#tag=v$pkgver")
b2sums=('e5bbc954348a78aeea4faeb5c5da8d4c2c14ae3c4079862ab2485275a1ffcc29f05fef1883336c1a05d3b46ec7a9c0742f0d387cb9b51dca8b931877f8ba7995')

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

check() {
  cd $_name
  PYTHONPATH="$PWD/$_name:$PYTHONPATH" 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
}
