# Template file for 'python3-packaging-bootstrap'
pkgname=python3-packaging-bootstrap
version=24.1
revision=1
# This package is required by python3-build, used by the python3-pep517 style;
# using that style here would create a cycle
build_style=python3-module
hostmakedepends="python3-flit_core-bootstrap python3-installer-bootstrap"
depends="python3"
short_desc="Core utilities for Python 3 packages (for xbps-src use)"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="Apache-2.0, BSD-2-Clause"
homepage="https://github.com/pypa/packaging"
distfiles="${PYPI_SITE}/p/packaging/packaging-${version}.tar.gz"
checksum=026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002
make_check=no # provides no tests, 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="/${py3_sitelib}-bootstrap"
	if [ -n "${PYTHONPATH}" ]; then
		pypath="${pypath}:${PYTHONPATH}"
	fi

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