# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-markdown-it-py
pkgver=3.0.0
pkgrel=1
pkgdesc="Markdown parser, done right"
url="https://markdown-it-py.readthedocs.io/"
arch="noarch"
license="MIT"
depends="python3 py3-attrs py3-mdurl"
makedepends="py3-gpep517 py3-flit-core"
checkdepends="py3-pytest py3-pytest-benchmark"
subpackages="$pkgname-pyc"
source="https://github.com/executablebooks/markdown-it-py/archive/v$pkgver/py3-markdown-it-py-$pkgver.tar.gz"
builddir="$srcdir/markdown-it-py-$pkgver"

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

check() {
	# fixture 'data_regression' not found
	# needs py3-pytest-regressions
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -k 'not test_linkify' \
		--deselect=tests/test_tree.py::test_pretty \
		--deselect=tests/test_api/test_main.py::test_table_tokens \
		--deselect=tests/test_cmark_spec/test_spec.py::test_file \
		--deselect=tests/test_port/test_references.py::test_use_existing_env \
		--deselect=tests/test_port/test_references.py::test_store_labels \
		--deselect=tests/test_port/test_references.py::test_inline_definitions
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/markdown_it_py-$pkgver-py3-none-any.whl
}

sha512sums="
820265595ab650f5ac64419d5c2687d1ee361d2a0550b9d94e86ec826cfe5e89cbd69e59d6582aac41d3b95f00ce4a0b7213bf6cd590fdbd8fd9b743c7418759  py3-markdown-it-py-3.0.0.tar.gz
"
