# Contributor: Thomas Boerger <thomas@webhippie.de>
# Maintainer: omni <omni+alpine@hack.org>
maintainer="omni <omni+alpine@hack.org>"
pkgname=mycli
pkgver=1.31.2
pkgrel=0
pkgdesc="MySQL CLI with autocompletion and syntax highlighting"
url="https://www.mycli.net/"
arch="noarch"
license="BSD-3-Clause"
depends="
	python3
	py3-cli_helpers
	py3-click
	py3-configobj
	py3-cryptography
	py3-prompt_toolkit
	py3-pyaes
	py3-pyfzf
	py3-pygments
	py3-pymysql
	py3-pyperclip
	py3-sqlglot
	py3-sqlparse
	"
makedepends="python3-dev py3-gpep517 py3-paramiko py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-mock"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/m/mycli/mycli-$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	# click 8.1 output differs
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -v test
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/test/
}

sha512sums="
1d3d427c07f9e5f9273c07ca45e9f46423b9263e2548b5e7e4f12ca90a7e7aa87c7b78ee48fc6f172b8a5074c5497a5186b059a4e4ef388252d83580fbd870e3  mycli-1.31.2.tar.gz
"
