From 9044b148e0c0738d73c85b20df6c4e2ad69924e2 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 3 Dec 2024 16:21:08 -0500 Subject: [PATCH] common/hooks/pre-pkg/06-verify-python-deps: add hook compares rdeps and Python module metadata to find missing dependencies for python packages. this uses virtual packages to map python canonical package names to void packages. --- common/hooks/pre-pkg/06-verify-python-deps.sh | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 common/hooks/pre-pkg/06-verify-python-deps.sh diff --git a/common/hooks/pre-pkg/06-verify-python-deps.sh b/common/hooks/pre-pkg/06-verify-python-deps.sh new file mode 100644 index 00000000000000..346dbb1fdbc81f --- /dev/null +++ b/common/hooks/pre-pkg/06-verify-python-deps.sh @@ -0,0 +1,22 @@ +# vim: set ts=4 sw=4 et: +# +# This hook executes the following tasks: +# - Verifies python module dependencies from dist-info's METADATA and egg-info's PKG-INFO + +py3_cmd() { + env PYTHONPATH="${XBPS_MASTERDIR}/${py3_sitelib}-bootstrap" "${py3_bin}" "$@" +} + +hook() { + local py3_bin="${XBPS_MASTERDIR}/usr/bin/python3" + local -a _pydeps=() + + if [ -z "$nopyprovides" ] && [ -d "${PKGDESTDIR}/${py3_sitelib}" ] && \ + [ -x "${py3_bin}" ] && py3_cmd -c "import packaging"; then + py3_cmd "${XBPS_COMMONDIR}"/scripts/parse-py-metadata.py \ + -S "${PKGDESTDIR}/${py3_sitelib}" -v "${pkgver}" depends \ + ${NOCOLORS:+-C} ${XBPS_STRICT:+-s} -e "${python_extras}" \ + -V <( $XBPS_QUERY_XCMD -R -p provides -s "py3:" ) -D "${PKGDESTDIR}/rdeps" \ + || msg_error "$pkgver: failed to verify python module dependencies\n" + fi +}