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

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..13} )

inherit distutils-r1 pypi xdg-utils desktop

DESCRIPTION="Just Another Ledger - project to track personal financial records"
HOMEPAGE="
	https://github.com/titov-vv/jal
	https://pypi.org/project/jal
"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

DEPEND=">=dev-lang/python-3.8.1
		>=dev-python/lxml-4.5.0[${PYTHON_USEDEP}]
		>=dev-python/pandas-1.1.1[${PYTHON_USEDEP}]
		>=dev-python/pyside6-6.5.1[${PYTHON_USEDEP},positioning,webengine,charts]
		>=dev-python/requests-2.24.0[${PYTHON_USEDEP}]
		>=dev-python/xlsxwriter-1.3.3[${PYTHON_USEDEP}]
		dev-python/jsonschema[${PYTHON_USEDEP}]
		dev-python/sqlparse[${PYTHON_USEDEP}]
		dev-python/oauthlib[${PYTHON_USEDEP}]
		dev-python/requests-oauthlib[${PYTHON_USEDEP}]"
RDEPEND="${DEPEND}"
BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
		dev-python/pytest[${PYTHON_USEDEP}]"

distutils_enable_tests pytest

src_install() {
        distutils-r1_src_install
        
        # Prepare the icons
        newicon "${PN}"/img/ui_jal.png "${PN}.png"

        # Create a desktop entry
        make_desktop_entry "${PN}" "JAL (Just Another Ledger)" "${PN}" "" "Comment[ru]=Контроль и учёт личных финансов;"
}

pkg_postinst() {
        xdg_icon_cache_update
        xdg_desktop_database_update
}

pkg_postrm() {
        xdg_icon_cache_update
        xdg_desktop_database_update
}
