# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=standalone
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{10..12} )

inherit distutils-r1 pypi

DESCRIPTION="A clean book theme for scientific explanations and documentation with Sphinx"
HOMEPAGE="https://sphinx-book-theme.readthedocs.io"
SRC_URI="https://github.com/executablebooks/sphinx-book-theme/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz
	$(pypi_wheel_url)
"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="code_style"
RESTRICT="doc? ( network-sandbox )"

RDEPEND=">=dev-python/sphinx-5[${PYTHON_USEDEP}]
	>=dev-python/pydata-sphinx-theme-0.14[${PYTHON_USEDEP}]
	code_style? ( dev-vcs/pre-commit )
"
BDEPEND="test? (
		dev-python/pytest-regressions[${PYTHON_USEDEP}]
		dev-python/myst-nb[${PYTHON_USEDEP}]
		dev-python/sphinx-thebe[${PYTHON_USEDEP}]
	)
"

distutils_enable_tests pytest
distutils_enable_sphinx docs dev-python/sphinx-copybutton \
	dev-python/sphinx-examples \
	dev-python/sphinx-tabs \
	dev-python/sphinx-thebe \
	dev-python/sphinx-togglebutton \
	dev-python/sphinx-design \
	dev-python/sphinxcontrib-bibtex \
	dev-python/sphinxcontrib-youtube \
	dev-python/sphinxext-opengraph \
	dev-python/ablog \
	dev-python/myst-nb \
	dev-python/numpydoc \
	dev-python/pandas \
	sci-geosciences/folium

python_compile() {
	distutils_wheel_install "${BUILD_DIR}/install" \
		"${DISTDIR}/$(pypi_wheel_name)"
}