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

EAPI=8

DISTUTILS_SINGLE_IMPL=1
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{12,13} )

inherit distutils-r1 
# pypi does not have the source tarball (yet?)

DESCRIPTION="Fast kernel library for Diffusion inference with multiple compute backends"
HOMEPAGE="https://github.com/Comfy-Org/comfy-kitchen"
SRC_URI="https://github.com/Comfy-Org/comfy-kitchen/archive/refs/tags/v${PV}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"
IUSE="cuda"

RDEPEND=""
DEPEND="
	>=dev-build/cmake-3.18.0
	$(python_gen_cond_dep '
		dev-python/nanobind[${PYTHON_USEDEP}]
	')
"

distutils_enable_tests pytest

python_configure_all() {
        use cuda || DISTUTILS_ARGS=( --no-cuda )
}

python_compile() {
        distutils-r1_python_compile
}

python_install() {
        distutils-r1_python_install --skip-build
}

python_install_all() {
        distutils-r1_python_install_all
}