2013-11-07 15:13:02 +01:00
|
|
|
{ stdenv, python, buildEnv, makeWrapper, recursivePthLoader, extraLibs ? [], postBuild ? ""
|
|
|
|
, stdLibs ? stdenv.lib.attrValues python.modules
|
|
|
|
}:
|
2012-02-26 18:23:22 +01:00
|
|
|
|
2013-08-15 09:52:25 +02:00
|
|
|
# Create a python executable that knows about additional packages.
|
2010-08-16 19:03:35 +02:00
|
|
|
|
2013-08-15 09:52:25 +02:00
|
|
|
(buildEnv {
|
2010-08-16 19:03:35 +02:00
|
|
|
name = "python-${python.version}-wrapper";
|
2013-11-07 15:13:02 +01:00
|
|
|
paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ stdLibs ++ [ python recursivePthLoader ];
|
2013-08-15 09:52:25 +02:00
|
|
|
ignoreCollisions = false;
|
2010-08-16 19:03:35 +02:00
|
|
|
|
2013-08-15 09:52:25 +02:00
|
|
|
postBuild = ''
|
|
|
|
. "${makeWrapper}/nix-support/setup-hook"
|
2013-11-07 13:59:44 +01:00
|
|
|
|
2013-10-03 21:25:43 +02:00
|
|
|
if [ -L "$out/bin" ]; then
|
|
|
|
unlink "$out/bin"
|
|
|
|
fi
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out/bin"
|
2013-11-07 13:59:44 +01:00
|
|
|
|
2013-08-15 09:52:25 +02:00
|
|
|
cd "${python}/bin"
|
|
|
|
for prg in *; do
|
|
|
|
rm -f "$out/bin/$prg"
|
|
|
|
makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
|
2010-08-16 19:03:35 +02:00
|
|
|
done
|
2013-11-07 15:13:02 +01:00
|
|
|
'' + postBuild;
|
2013-08-15 09:52:25 +02:00
|
|
|
}) // {
|
2010-08-16 19:03:35 +02:00
|
|
|
inherit python;
|
|
|
|
inherit (python) meta;
|
|
|
|
}
|