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-12-20 20:10:22 +01:00
parent a648bdeede
commit 8f3162f83f
6 changed files with 168 additions and 0 deletions
@@ -0,0 +1,30 @@
{ stdenv
, python
, flit-core
, installer
, packaging
}:
stdenv.mkDerivation {
pname = "${python.libPrefix}-bootstrap-${packaging.pname}";
inherit (packaging) version src meta;
buildPhase = ''
runHook preBuild
PYTHONPATH="${flit-core}/${python.sitePackages}" \
${python.interpreter} -m flit_core.wheel
runHook postBuild
'';
installPhase = ''
runHook preInstall
PYTHONPATH="${installer}/${python.sitePackages}" \
${python.interpreter} -m installer \
--destdir "$out" --prefix "" dist/*.whl
runHook postInstall
'';
}