about summary refs log tree commit diff
path: root/pkgs/development/interpreters/python
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2013-08-15 09:52:25 +0200
committerPeter Simons <simons@cryp.to>2013-10-02 22:47:19 +0200
commit742d6597cac218d0a5fe6030fdc270f7a83d70a0 (patch)
tree4ca450f3697e5eba6e8a20fe442dd763a8a27c90 /pkgs/development/interpreters/python
parent1d03574722bd01338f9052b458829f31925f4d21 (diff)
downloadnixlib-742d6597cac218d0a5fe6030fdc270f7a83d70a0.tar
nixlib-742d6597cac218d0a5fe6030fdc270f7a83d70a0.tar.gz
nixlib-742d6597cac218d0a5fe6030fdc270f7a83d70a0.tar.bz2
nixlib-742d6597cac218d0a5fe6030fdc270f7a83d70a0.tar.lz
nixlib-742d6597cac218d0a5fe6030fdc270f7a83d70a0.tar.xz
nixlib-742d6597cac218d0a5fe6030fdc270f7a83d70a0.tar.zst
nixlib-742d6597cac218d0a5fe6030fdc270f7a83d70a0.zip
Re-implement python-wrapper with buildEnv.
The new wrapper creates an environment that contains all files from
Python and the extra libraries that have been specified. All files are
found at run-time by means of the $PYTHONHOME variable; the wrapper no
longer uses $PYTHONPATH.
Diffstat (limited to 'pkgs/development/interpreters/python')
-rw-r--r--pkgs/development/interpreters/python/wrapper.nix26
1 files changed, 13 insertions, 13 deletions
diff --git a/pkgs/development/interpreters/python/wrapper.nix b/pkgs/development/interpreters/python/wrapper.nix
index d2783ffb085e..d928e96dd4b8 100644
--- a/pkgs/development/interpreters/python/wrapper.nix
+++ b/pkgs/development/interpreters/python/wrapper.nix
@@ -1,23 +1,23 @@
-# Create a python that knows about additional python packages via
-# PYTHONPATH
+{ stdenv, python, buildEnv, makeWrapper, recursivePthLoader, extraLibs ? [] }:
 
-{ stdenv, python, makeWrapper, recursivePthLoader, extraLibs ? [] }:
+# Create a python executable that knows about additional packages.
 
-stdenv.mkDerivation {
+(buildEnv {
   name = "python-${python.version}-wrapper";
+  paths = extraLibs ++ [ python makeWrapper recursivePthLoader ];
+  ignoreCollisions = false;
 
-  propagatedBuildInputs = extraLibs ++ [ python makeWrapper recursivePthLoader ];
-
-  unpackPhase = "true";
-  installPhase = ''
+  postBuild = ''
+    . "${makeWrapper}/nix-support/setup-hook"
     mkdir -p "$out/bin"
-    for prg in 2to3 idle pdb pdb${python.majorVersion} pydoc python python-config python${python.majorVersion} python${python.majorVersion}-config smtpd.py; do
-      makeWrapper "$python/bin/$prg" "$out/bin/$prg" --suffix PYTHONPATH : "$PYTHONPATH"
+    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
-    ensureDir "$out/share"
-    ln -s "$python/share/man" "$out/share/man"
   '';
-
+}) // {
   inherit python;
   inherit (python) meta;
 }