python3Packages.pythonImportsCheck: set $PYTHONPATH

Don't rely on the installPhase doing so.
This commit is contained in:
Robert Schütz 2022-05-29 03:35:59 +00:00 committed by Robert Schütz
parent 967daf62ee
commit fa3feb9f65
2 changed files with 2 additions and 1 deletions

View File

@ -93,7 +93,7 @@ in {
makePythonHook {
name = "python-imports-check-hook.sh";
substitutions = {
inherit pythonCheckInterpreter;
inherit pythonCheckInterpreter pythonSitePackages;
};
} ./python-imports-check-hook.sh) {};

View File

@ -6,6 +6,7 @@ pythonImportsCheckPhase () {
if [ -n "$pythonImportsCheck" ]; then
echo "Check whether the following modules can be imported: $pythonImportsCheck"
export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH"
( cd $out && eval "@pythonCheckInterpreter@ -c 'import os; import importlib; list(map(lambda mod: importlib.import_module(mod), os.environ[\"pythonImportsCheck\"].split()))'" )
fi
}