# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=py3-lsp-server
pkgver=1.12.2
pkgrel=0
pkgdesc="python implementation of the language server protocol, fork of python-language-server"
url="https://github.com/python-lsp/python-lsp-server"
arch="noarch !armhf"  # armhf: no py3-qt
license="MIT"
depends="
	py3-docstring-to-markdown
	py3-jedi
	py3-lsp-jsonrpc
	py3-pluggy
	py3-setuptools
	py3-ujson
	python3
	"
makedepends="
	py3-gpep517
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="
	py3-autopep8
	py3-flake8
	py3-flaky
	py3-matplotlib
	py3-mccabe
	py3-numpy
	py3-pandas
	py3-pycodestyle
	py3-pyflakes
	py3-pylint
	py3-pytest
	py3-pytest-cov
	py3-python-versioneer
	py3-qt5
	py3-rope
	py3-toml
	py3-whatthepatch
	py3-yapf
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/python-lsp/python-lsp-server/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/python-lsp-server-$pkgver"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	local k="not test_jedi_completion_environment"
	k="$k and not test_symbols_all_scopes_with_jedi_environment"
	# fails on riscv64
	k="$k and not test_autoimport_code_actions_and_completions_for_notebook_document"
	# fails on s390x
	k="$k and not test_jedi_completion_with_fuzzy_enabled"
	# requires deprecated pydocstyle
	k="$k and not test_notebook_document__did_open and not test_notebook_document__did_change"
	# deselect'ed tests are broken
	# pydocstyle is no longer maintaned upstream
	.testenv/bin/python3 -m pytest \
		--ignore test/plugins/test_pydocstyle_lint.py \
		-k "$k"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
de6aab7ee0bdbffc300e130e9f02a307d3278aece9a6957dcfc3a9c83af94cb4c5b4ea645f87af82e18f8b2a6d73d4120f4f09e111a1edeccf1308f93bbe6d38  py3-lsp-server-1.12.2.tar.gz
"
