# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

_pkgname=LibCST
pkgname=python-libcst
pkgver=1.8.6
pkgrel=1
pkgdesc="A concrete syntax tree parser and serializer library for Python that preserves many aspects of Python's abstract syntax tree"
arch=('x86_64' 'aarch64')
url='https://github.com/Instagram/LibCST'
license=('MIT')
depends=('glibc' 'gcc-libs' 'python' 'python-pyyaml')
makedepends=('python-build' 'python-installer'
             'python-setuptools-rust' 'python-setuptools-scm' 'python-wheel')
#checkdepends=('python-hypothesis' 'python-hypothesmith')
#source=("https://pypi.io/packages/source/l/libcst/libcst-$pkgver.tar.gz")
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha512sums=('deea98a577125aa4f17c563d3be911b27f7ef5a978807e52b79ffa873deaaa02ea12b7916c45c64bab66540e3d2718c4cabf46bab3cb5c121600b3012c028791')

#prepare() {
#  cd $_pkgname-$pkgver
#
#  sed -i '/pyre.*start/d' scripts/regenerate-fixtures.py
#  python scripts/regenerate-fixtures.py
#}

build() {
  cd $_pkgname-$pkgver

  SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver python -m build --wheel --no-isolation
}

#check() {
#  cd $_pkgname-$pkgver
#
#  python -m venv --system-site-packages testenv
#  python -m installer --prefix=testenv dist/*.whl
#
#  testenv/bin/python -m libcst.tests
#}

package() {
  cd $_pkgname-$pkgver

  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/

  # remove tests
  rm -rfv "$pkgdir"/usr/lib/python*/site-packages/libcst/tests/
  rm -rfv "$pkgdir"/usr/lib/python*/site-packages/libcst/**/tests/
}

# vim:set ts=2 sw=2 et:
