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

EAPI=8
PYTHON_COMPAT=( python3_{8..12} )
DISTUTILS_SINGLE_IMPL=1

inherit distutils-r1

DESCRIPTION="deb-changectl only reads from the git log and writes to the changelog"
HOMEPAGE="https://github.com/seanodea/deb-changectl"
SRC_URI="https://github.com/seanodea/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~x86-linux"
IUSE=""
REQUIRED_USE=${PYTHON_REQUIRED_USE}

RDEPEND="dev-python/pyyaml
	dev-python/python-debian
	dev-python/GitPython"
DEPEND="${RDEPEND}"

src_prepare() {
       # unpin deps
       cat ${FILESDIR}/setup.py > setup.py || die
       echo "" > ${PN}/release/__init__.py
       echo "" > ${PN}/snapshot/__init__.py
       sed -e 's!from !from deb_changectl.!g' -i ${PN}/${PN}.py
       mv ${PN}/${PN}.py ${PN}/${PN}
       mv ${PN} deb_changectl

       distutils-r1_src_prepare
}