Python: introduce NIX_PYTHONEXECUTABLE in order to set sys.executable

This is needed in case of `python.buildEnv` to make sure sys.executable
does not point to the unwrapped executable.
This commit is contained in:
Frederik Rietdijk
2019-07-27 09:30:34 +02:00
committed by Frederik Rietdijk
parent c9793b81b8
commit bd47c5721f
2 changed files with 10 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ let
env = let
paths = requiredPythonModules (extraLibs ++ [ python ] ) ;
pythonPath = "${placeholder "out"}/${python.sitePackages}";
pythonExecutable = "${placeholder "out"}/bin/${python.executable}";
in buildEnv {
name = "${python.name}-env";
@@ -36,7 +37,7 @@ let
if [ -f "$prg" ]; then
rm -f "$out/bin/$prg"
if [ -x "$prg" ]; then
makeWrapper "$path/bin/$prg" "$out/bin/$prg" --set NIX_PYTHONPATH ${pythonPath} ${if permitUserSite then "" else ''--set PYTHONNOUSERSITE "true"''} ${stdenv.lib.concatStringsSep " " makeWrapperArgs}
makeWrapper "$path/bin/$prg" "$out/bin/$prg" --set NIX_PYTHONEXECUTABLE ${pythonExecutable} --set NIX_PYTHONPATH ${pythonPath} ${if permitUserSite then "" else ''--set PYTHONNOUSERSITE "true"''} ${stdenv.lib.concatStringsSep " " makeWrapperArgs}
fi
fi
done