# Template file for 'python3-installer-bootstrap'
pkgname=python3-installer-bootstrap
version=0.7.0
revision=1
# This package is used by the python3-pep517 build style; using that style here
# would create a build cycle
build_style=python3-module
hostmakedepends="python3-flit_core-bootstrap"
depends="python3"
short_desc="Low-level library for installing from a Python wheel (for xbps-src use)"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="MIT"
homepage="https://installer.readthedocs.io/"
distfiles="${PYPI_SITE}/i/installer/installer-${version}.tar.gz"
checksum=a26d3e3116289bb08216e0d0f7d925fcef0b0194eedfa0c944bcaaa106c4b631
make_check=no # bootstrap
repository=bootstrap
nopyprovides=yes
noverifypydeps=yes

do_build() {
	local pypath="/${py3_sitelib}-bootstrap"
	if [ -n "${PYTHONPATH}" ]; then
		pypath="${pypath}:${PYTHONPATH}"
	fi

	PYTHONPATH="${pypath}" python3 -m flit_core.wheel
}

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

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

	vlicense LICENSE
}
