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

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{11..14} )

inherit distutils-r1 edo git-r3

COMMIT="280497fa5f12e43d7233aed0d74e07ca61ef176b"

DESCRIPTION="Python Library for TOML"
HOMEPAGE="https://github.com/uiri/toml"
EGIT_REPO_URI="https://github.com/uiri/${PN}.git"
SRC_URI="test? ( https://github.com/BurntSushi/toml-test/archive/${COMMIT}.tar.gz
		-> toml-test-${COMMIT}.tar.gz )"

LICENSE="MIT"
SLOT="0"
IUSE="test"

BDEPEND="test? ( dev-python/numpy[${PYTHON_USEDEP}] )"

distutils_enable_tests pytest

src_unpack() {
	git-r3_src_unpack
	unpack "${A}"
}

python_prepare_all() {
	if use test; then
		edo mv "${WORKDIR}"/toml-test-"${COMMIT}" "${S}"/toml-test
	fi

	distutils-r1_python_prepare_all
}