python: apply wrapper to all packages in python.buildEnv extraLibs
Currently, when constructing a buildEnv and adding packages via extraLibs, then binaries in extraLibs cannot access the other Python modules. An example is having ipython/jupyter in extraLibs; in that case ipython cannot import any other modules.
This commit is contained in:
parent
7ae05edcdd
commit
12e8f3c6aa
@ -6,10 +6,13 @@
|
|||||||
# Create a python executable that knows about additional packages.
|
# Create a python executable that knows about additional packages.
|
||||||
let
|
let
|
||||||
recursivePthLoader = import ../../python-modules/recursive-pth-loader/default.nix { stdenv = stdenv; python = python; };
|
recursivePthLoader = import ../../python-modules/recursive-pth-loader/default.nix { stdenv = stdenv; python = python; };
|
||||||
env = (buildEnv {
|
env = (
|
||||||
name = "${python.name}-env";
|
let
|
||||||
paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
|
paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
|
||||||
|
in buildEnv {
|
||||||
|
name = "${python.name}-env";
|
||||||
|
|
||||||
|
inherit paths;
|
||||||
inherit ignoreCollisions;
|
inherit ignoreCollisions;
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
@ -20,10 +23,16 @@ let
|
|||||||
fi
|
fi
|
||||||
mkdir -p "$out/bin"
|
mkdir -p "$out/bin"
|
||||||
|
|
||||||
cd "${python}/bin"
|
for path in ${stdenv.lib.concatStringsSep " " paths}; do
|
||||||
|
if [ -d "$path/bin" ]; then
|
||||||
|
cd "$path/bin"
|
||||||
for prg in *; do
|
for prg in *; do
|
||||||
|
if [ -f "$prg" ]; then
|
||||||
rm -f "$out/bin/$prg"
|
rm -f "$out/bin/$prg"
|
||||||
makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
|
makeWrapper "$path/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
'' + postBuild;
|
'' + postBuild;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user