nixpkgs/pkgs/development/interpreters/python/wrapper.nix
Peter Simons 46419ae454 python-wrapper: recursively include all dependencies of the specified 'extraLibs' in the generated environment
This patch means that adding 'matplotlib' to extraLibs will automatically
include 'numpy', too, because matplotlib depends on it.
2013-11-07 14:00:08 +01:00

29 lines
765 B
Nix

{ stdenv, python, buildEnv, makeWrapper, recursivePthLoader, extraLibs ? [] }:
# Create a python executable that knows about additional packages.
(buildEnv {
name = "python-${python.version}-wrapper";
paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python 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;
}