# Template file for 'python3-flit_core'
pkgname=python3-flit_core
version=3.8.0
revision=1
build_wrksrc="flit-${version}/flit_core"
# This package is required by python3-build and python3-installer, used by the
# python3-pep517 style; so using that style here would create a cycle
build_style=python3-module
hostmakedepends="python3"
depends="python3"
checkdepends="python3-pytest python3-testpath $depends"
short_desc="Simplified packaging of Python modules - PEP 517 build backend"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="BSD-3-Clause"
homepage="https://flit.readthedocs.io"
changelog="https://flit.readthedocs.io/en/latest/history.html"
# Pull the installer package directly to bootstrap the pep517 toolchain
_installer_version="0.5.1"
distfiles="${PYPI_SITE}/f/flit/flit-${version}.tar.gz
 ${PYPI_SITE}/i/installer/installer-${_installer_version}.tar.gz
"
checksum="d0f2a8f4bd45dc794befbf5839ecc0fd3830d65a57bd52b5997542fac5d5e937
 f970995ec2bb815e2fdaf7977b26b2091e1e386f0f42eafd5ac811953dc5d445"

do_build() {
	python3 -m flit_core.wheel
}

do_install() {
	local pypath="../../installer-${_installer_version}/src"
	if [ -n "${PYTHONPATH}" ]; then
		pypath="${pypath}:${PYTHONPATH}"
	fi

	PYTHONPATH="${pypath}" python3 -m installer --destdir "${DESTDIR}" \
		"dist/flit_core-${version}-py3-none-any.whl"

	vlicense ../LICENSE
}
