# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7
PYTHON_COMPAT=( python{3_6,3_7,3_8} )
DISTUTILS_USE_SETUPTOOLS="rdepend"

inherit distutils-r1

DESCRIPTION="A CMS to generate a static websites"
HOMEPAGE="https://www.getlektor.com/"
SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="examples"

DEPEND="media-gfx/imagemagick
	<net-libs/nodejs-14[npm]
	dev-python/Babel[${PYTHON_USEDEP}]
	dev-python/click[${PYTHON_USEDEP}]
	dev-python/exifread[${PYTHON_USEDEP}]
	dev-python/flask[${PYTHON_USEDEP}]
	dev-python/jinja[${PYTHON_USEDEP}]
	dev-python/mistune[${PYTHON_USEDEP}]
	dev-python/pip[${PYTHON_USEDEP}]
	dev-python/python-inifile[${PYTHON_USEDEP}]
	dev-python/requests[${PYTHON_USEDEP}]
	dev-python/watchdog[${PYTHON_USEDEP}]"
RDEPEND=""

DOCS=( CHANGES LICENSE README.md )

src_prepare() {
	default

	# unpack static webcontent, pre-compiled with:
	# ebuild ${P}.ebuild unpack
	# cd /var/tmp/portage/www-apps/${P}/work/${P}
	# su -s /bin/bash -c "make build-js" portage
	# tar cfvz /var/lib/layman/unitas/www-apps/lektor/files/${PN}-static-${PV}.tar.gz lektor/admin/static
	unpack ${FILESDIR}/${PN}-static-${PV}.tar.gz
}

python_install_all() {
	if use examples; then
		insinto "/usr/share/doc/${PF}"
		docompress -x "/usr/share/doc/${PF}/example"
		doins -r example
	fi
	distutils-r1_python_install_all
}
