python3.pkgs.pythonRuntimeDepsCheckHook: init

Implements a hook, that checks whether all dependencies, as specified by
the wheel manifest, are present in the current environment.

Complains about missing packages, as well as version specifier
mismatches.
This commit is contained in:
Martin Weinelt
2023-11-27 19:14:35 +01:00
parent a648bdeede
commit 8f3162f83f
6 changed files with 168 additions and 0 deletions
@@ -0,0 +1,20 @@
# Setup hook for PyPA installer.
echo "Sourcing python-runtime-deps-check-hook"
pythonRuntimeDepsCheckHook() {
echo "Executing pythonRuntimeDepsCheck"
export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH"
for wheel in dist/*.whl; do
echo "Checking runtime dependencies for $(basename $wheel)"
@pythonInterpreter@ @hook@ "$wheel"
done
echo "Finished executing pythonRuntimeDepsCheck"
}
if [ -z "${dontCheckRuntimeDeps-}" ]; then
echo "Using pythonRuntimeDepsCheckHook"
preInstallPhases+=" pythonRuntimeDepsCheckHook"
fi