2014-10-19 17:48:07 +00:00
|
|
|
{ stdenv, python, buildEnv, makeWrapper
|
|
|
|
, extraLibs ? []
|
|
|
|
, postBuild ? ""
|
2014-10-12 12:59:31 +00:00
|
|
|
, ignoreCollisions ? false }:
|
2012-02-26 17:23:22 +00:00
|
|
|
|
2013-08-15 07:52:25 +00:00
|
|
|
# Create a python executable that knows about additional packages.
|
2014-10-19 17:48:07 +00:00
|
|
|
let
|
|
|
|
recursivePthLoader = import ../../python-modules/recursive-pth-loader/default.nix { stdenv = stdenv; python = python; };
|
|
|
|
in
|
2013-08-15 07:52:25 +00:00
|
|
|
(buildEnv {
|
2014-10-19 17:48:07 +00:00
|
|
|
name = "${python.name}-env";
|
2014-10-12 12:59:31 +00:00
|
|
|
paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
|
2014-02-24 11:41:12 +00:00
|
|
|
|
|
|
|
inherit ignoreCollisions;
|
2010-08-16 17:03:35 +00:00
|
|
|
|
2013-08-15 07:52:25 +00:00
|
|
|
postBuild = ''
|
|
|
|
. "${makeWrapper}/nix-support/setup-hook"
|
2013-11-07 12:59:44 +00:00
|
|
|
|
2013-10-03 19:25:43 +00:00
|
|
|
if [ -L "$out/bin" ]; then
|
|
|
|
unlink "$out/bin"
|
|
|
|
fi
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p "$out/bin"
|
2013-11-07 12:59:44 +00:00
|
|
|
|
2013-08-15 07:52:25 +00: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 17:03:35 +00:00
|
|
|
done
|
2013-11-07 14:13:02 +00:00
|
|
|
'' + postBuild;
|
2013-08-15 07:52:25 +00:00
|
|
|
}) // {
|
2010-08-16 17:03:35 +00:00
|
|
|
inherit python;
|
|
|
|
inherit (python) meta;
|
|
|
|
}
|