mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-20 04:33:57 +00:00
fa3feb9f65
Don't rely on the installPhase doing so.
18 lines
707 B
Bash
18 lines
707 B
Bash
# Setup hook for checking whether Python imports succeed
|
|
echo "Sourcing python-imports-check-hook.sh"
|
|
|
|
pythonImportsCheckPhase () {
|
|
echo "Executing 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
|
|
}
|
|
|
|
if [ -z "${dontUsePythonImportsCheck-}" ]; then
|
|
echo "Using pythonImportsCheckPhase"
|
|
preDistPhases+=" pythonImportsCheckPhase"
|
|
fi
|