nixpkgs/pkgs/development/interpreters/python/wrapper.nix
Shea Levy f6e835a2c3 Fix pythonWrapper when all of the binaries come from python
See discussion in #834

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-10-03 15:25:43 -04:00

27 lines
706 B
Nix

{ stdenv, python, buildEnv, makeWrapper, recursivePthLoader, extraLibs ? [] }:
# Create a python executable that knows about additional packages.
(buildEnv {
name = "python-${python.version}-wrapper";
paths = extraLibs ++ [ python makeWrapper recursivePthLoader ];
ignoreCollisions = false;
postBuild = ''
. "${makeWrapper}/nix-support/setup-hook"
if [ -L "$out/bin" ]; then
unlink "$out/bin"
fi
mkdir -p "$out/bin"
cd "${python}/bin"
for prg in *; do
echo "$prg --> $out/bin/$prg"
rm -f "$out/bin/$prg"
makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
done
'';
}) // {
inherit python;
inherit (python) meta;
}