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

EAPI=8

PYTHON_COMPAT=( python3_{12..14} )

inherit python-r1

MY_PN="${PN//-/_}"
DESCRIPTION="Redistributable ANGLE libraries"
HOMEPAGE="https://github.com/Comfy-Org/comfy-angle"
SRC_URI="https://files.pythonhosted.org/packages/py3/c/${MY_PN}/${MY_PN}-${PV}-py3-none-manylinux_2_28_x86_64.whl -> ${P}.whl"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="${PYTHON_DEPS}"

S="${WORKDIR}"

src_unpack() {
	# Wheels are zip files
	unzip "${DISTDIR}/${P}.whl" -d "${S}" || die
}

src_install() {
	python_foreach_impl _do_install
}

_do_install() {
	python_moduleinto comfy_angle
	python_domodule comfy_angle/__init__.py
	# Install native ANGLE libraries
	insinto "$(python_get_sitedir)/comfy_angle/libs"
	doins comfy_angle/libs/*
}