2020-12-02 22:20:18 -05:00
|
|
|
#
|
|
|
|
# This style is for templates installing python3 modules adhering to PEP517
|
|
|
|
#
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
: ${make_build_target:=.}
|
2022-11-08 11:48:04 -05:00
|
|
|
: ${make_build_args:=--no-isolation --wheel}
|
|
|
|
python3 -m build ${make_build_args} ${make_build_target}
|
2020-12-02 22:20:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
do_check() {
|
2022-05-14 15:23:13 -04:00
|
|
|
local testjobs
|
2021-06-07 23:41:26 -04:00
|
|
|
if python3 -c 'import pytest' >/dev/null 2>&1; then
|
2022-05-14 15:23:13 -04:00
|
|
|
if python3 -c 'import xdist' >/dev/null 2>&1; then
|
|
|
|
testjobs="-n $XBPS_MAKEJOBS"
|
|
|
|
fi
|
2023-02-01 11:16:05 +05:30
|
|
|
|
|
|
|
if [ -z "${make_install_target}" ]; then
|
|
|
|
local wheelbase="${pkgname#python3-}"
|
|
|
|
make_install_target="dist/${wheelbase//-/_}-${version}-*-*-*.whl"
|
|
|
|
fi
|
|
|
|
|
2023-05-07 11:23:17 +02:00
|
|
|
local testdir="${wrksrc}/tmp/$(date +%s)"
|
2023-02-01 11:16:05 +05:30
|
|
|
python3 -m installer --destdir "${testdir}" \
|
|
|
|
${make_install_args} ${make_install_target}
|
|
|
|
|
|
|
|
PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" \
|
|
|
|
${make_check_pre} pytest3 ${testjobs} ${make_check_args} ${make_check_target}
|
2020-12-02 22:20:18 -05:00
|
|
|
else
|
2022-11-10 02:27:52 +02:00
|
|
|
msg_warn "Unable to determine tests for PEP517 Python templates\n"
|
2020-12-02 22:20:18 -05:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
2022-05-16 10:26:50 -04:00
|
|
|
if [ -z "${make_install_target}" ]; then
|
|
|
|
# Default wheel name normalizes hyphens to underscores
|
|
|
|
local wheelbase="${pkgname#python3-}"
|
2022-11-08 11:48:04 -05:00
|
|
|
make_install_target="dist/${wheelbase//-/_}-${version}-*-*-*.whl"
|
2022-05-16 10:26:50 -04:00
|
|
|
fi
|
2020-12-02 22:20:18 -05:00
|
|
|
|
2022-11-08 11:48:04 -05:00
|
|
|
python3 -m installer --destdir ${DESTDIR} \
|
|
|
|
${make_install_args} ${make_install_target}
|
2020-12-02 22:20:18 -05:00
|
|
|
}
|