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

EAPI=8

DISTUTILS_SINGLE_IMPL=true
DISTUTILS_USE_PEP517=poetry
PYTHON_COMPAT=( python3_{12..13} )

inherit desktop distutils-r1 xdg

DESCRIPTION="Graphical application to manage and use Nitrokey 3 devices"
HOMEPAGE="
	https://github.com/Nitrokey/nitrokey-app2/
	https://docs.nitrokey.com/software/nk-app2/
"
SRC_URI="https://github.com/Nitrokey/nitrokey-app2/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	$(python_gen_cond_dep '
		=dev-python/fido2-2*:=[${PYTHON_USEDEP}]
		<dev-python/fido2-3:=[${PYTHON_USEDEP}]
		>=dev-python/nitrokey-0.4.2[${PYTHON_USEDEP}]
		<dev-python/nitrokey-0.5[${PYTHON_USEDEP}]
		>=dev-python/pyside-6.6.0:6=[core,gui,svg,uitools,widgets,${PYTHON_USEDEP}]
		>=dev-python/usb-monitor-1.21[${PYTHON_USEDEP}]
	')
"

src_install() {
	distutils-r1_src_install

	domenu meta/com.nitrokey.nitrokey-app2.desktop
	newicon -s scalable meta/nk-app2.svg com.nitrokey.nitrokey-app2.svg
	newicon -s 128 meta/nk-app2.png com.nitrokey.nitrokey-app2.png

	insinto /usr/share/metainfo
	doins meta/com.nitrokey.nitrokey-app2.metainfo.xml
}
