From d163f12f2c48055e99cca3e3a0382906093d1c77 Mon Sep 17 00:00:00 2001 From: Moritz Sanft <58110325+msanft@users.noreply.github.com> Date: Wed, 17 Apr 2024 09:48:28 +0200 Subject: [PATCH] python/hooks/python-imports-check-hook: use $python output if existing --- .../python/hooks/python-imports-check-hook.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh b/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh index 7172ac498545..b65d6e745247 100644 --- a/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh @@ -6,8 +6,13 @@ 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()))'" ) + pythonImportsCheckOutput=$out + if [ -n "$python" ]; then + echo "Using python specific output \$python for imports check" + pythonImportsCheckOutput=$python + fi + export PYTHONPATH="$pythonImportsCheckOutput/@pythonSitePackages@:$PYTHONPATH" + ( cd $pythonImportsCheckOutput && eval "@pythonCheckInterpreter@ -c 'import os; import importlib; list(map(lambda mod: importlib.import_module(mod), os.environ[\"pythonImportsCheck\"].split()))'" ) fi }