File PKGBUILD of Package python-pygls

# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Otreblan <otreblain@gmail.com>

pkgname=python-pygls
_name=${pkgname#python-}
pkgver=2.0.0
pkgrel=1
pkgdesc='Pythonic generic implementation of the Language Server Protocol'
arch=(any)
url=https://github.com/openlawlibrary/pygls
license=(Apache-2.0)
depends=(
  python-attrs
  python-cattrs
  python-lsprotocol
)
makedepends=(
  git
  python-build
  python-installer
  python-poetry-core
)
checkdepends=(python-pytest-asyncio)
source=("git+$url.git#tag=v$pkgver")
b2sums=('db43d6da778d53ca879bf702a04e0779ec66dd6994987677b38c19b0fd88ccb30f2bfd5a556c50a85bdae879e08c54ab4cf7d92d029d7aff4b270f039ae63290')

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

check() {
  cd "$_name"
  PYTHONPATH="$PWD/$_name:$PYTHONPATH" pytest
}

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

  cd "$_name"
  python -m installer --destdir="$pkgdir" dist/*.whl
}

source[0]="$_name.tar.xz"
b2sums[0]="SKIP"
openSUSE Build Service is sponsored by