summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/wrapper.nix
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2015-11-19 13:16:15 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2015-11-30 10:52:57 +0100
commit12e8f3c6aae56353510314391072912fae5ef3ed (patch)
tree5cbd587b10c164689bf6fc33314a403b234652ea /pkgs/development/interpreters/python/wrapper.nix
parent7ae05edcdd14f6ace83ead9bf0d114e97c89a83a (diff)
downloadnixpkgs-12e8f3c6aae56353510314391072912fae5ef3ed.tar
nixpkgs-12e8f3c6aae56353510314391072912fae5ef3ed.tar.gz
nixpkgs-12e8f3c6aae56353510314391072912fae5ef3ed.tar.bz2
nixpkgs-12e8f3c6aae56353510314391072912fae5ef3ed.tar.lz
nixpkgs-12e8f3c6aae56353510314391072912fae5ef3ed.tar.xz
nixpkgs-12e8f3c6aae56353510314391072912fae5ef3ed.tar.zst
nixpkgs-12e8f3c6aae56353510314391072912fae5ef3ed.zip
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.
Diffstat (limited to 'pkgs/development/interpreters/python/wrapper.nix')
-rw-r--r--pkgs/development/interpreters/python/wrapper.nix21
1 files changed, 15 insertions, 6 deletions
diff --git a/pkgs/development/interpreters/python/wrapper.nix b/pkgs/development/interpreters/python/wrapper.nix
index f757147b047..ba39965cb35 100644
--- a/pkgs/development/interpreters/python/wrapper.nix
+++ b/pkgs/development/interpreters/python/wrapper.nix
@@ -6,10 +6,13 @@
 # Create a python executable that knows about additional packages.
 let
   recursivePthLoader = import ../../python-modules/recursive-pth-loader/default.nix { stdenv = stdenv; python = python; };
-  env = (buildEnv {
-    name = "${python.name}-env";
+  env = (
+  let
     paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
+  in buildEnv {
+    name = "${python.name}-env";
 
+    inherit paths;
     inherit ignoreCollisions;
 
     postBuild = ''
@@ -20,10 +23,16 @@ let
       fi
       mkdir -p "$out/bin"
 
-      cd "${python}/bin"
-      for prg in *; do
-        rm -f "$out/bin/$prg"
-        makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
+      for path in ${stdenv.lib.concatStringsSep " " paths}; do
+        if [ -d "$path/bin" ]; then
+          cd "$path/bin"
+          for prg in *; do
+            if [ -f "$prg" ]; then
+              rm -f "$out/bin/$prg"
+              makeWrapper "$path/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
+            fi
+          done
+        fi
       done
     '' + postBuild;