# Template file for 'python-Jinja2'
pkgname=python-Jinja2
version=2.10.1
revision=2
archs=noarch
wrksrc="Jinja2-${version}"
build_style=python-module
pycompile_module="jinja2"
hostmakedepends="python-setuptools python3-setuptools"
depends="python-MarkupSafe"
checkdepends="python-MarkupSafe python3-MarkupSafe python-pytest python3-pytest"
short_desc="Full featured template engine (Python2)"
maintainer="Alessio Sergi <al3hex@gmail.com>"
license="BSD-3-Clause"
homepage="http://jinja.pocoo.org/"
distfiles="${PYPI_SITE}/J/Jinja2/Jinja2-${version}.tar.gz"
checksum=065c4f02ebe7f7cf559e49ee5a95fb800a9e4528727aec6f24402a5374c65013

do_check() {
	python2 -m pytest tests/
	python3 -m pytest tests/
}

post_install() {
	vlicense LICENSE
	# these files are valid only on Python 3.6+
	rm -f ${DESTDIR}/${py2_sitelib}/jinja2/asyncsupport.py
	rm -f ${DESTDIR}/${py2_sitelib}/jinja2/asyncfilters.py
}

python3-Jinja2_package() {
	archs=noarch
	depends="python3-MarkupSafe"
	pycompile_module="jinja2"
	short_desc="${short_desc/Python2/Python3}"
	pkg_install() {
		vmove usr/lib/python3*
		vlicense LICENSE
	}
}
