# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{13..15} )

inherit distutils-r1 pypi

DESCRIPTION="A formatter for reStructuredText"
HOMEPAGE="https://github.com/dzhu/rstfmt https://pypi.org/project/rstfmt/"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="
	>=dev-python/black-22.1.0[${PYTHON_USEDEP}]
	>=dev-python/docutils-0.12[${PYTHON_USEDEP}]
	>=dev-python/sphinx-2.4.0[${PYTHON_USEDEP}]
"

python_test() {
	# Upstream's suite: format each sample and check the result round-trips.
	"${EPYTHON}" -m rstfmt --test tests || die "Tests failed with ${EPYTHON}"
}