Author: eelco
Date: Mon Mar 28 17:19:27 2011
New Revision: 26583
URL: https://svn.nixos.org/websvn/nix/?rev=26583&sc=1

Log:
* wrapPythonPrograms: rewrite the common "#! .../env python" idiom to
  "#! .../python".

Modified:
   
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/wrap.sh
   nixpkgs/branches/modular-python/pkgs/servers/gpsd/default.nix
   nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix

Modified: 
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/wrap.sh
==============================================================================
--- 
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/wrap.sh 
    Mon Mar 28 16:48:31 2011        (r26582)
+++ 
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/wrap.sh 
    Mon Mar 28 17:19:27 2011        (r26583)
@@ -5,6 +5,7 @@
 wrapPythonProgramsIn() {
     local dir="$1"
     local pythonPath="$2"
+    local python="$(type -p python)"
     local i
 
     declare -A pythonPathsSeen=()
@@ -15,6 +16,12 @@
     done
 
     for i in $(find "$dir" -type f -perm +0100); do
+
+        # Rewrite "#! .../env python" to "#! /nix/store/.../python".
+        if head -n1 "$i" | grep -q '#!.*/env.*python'; then
+            sed -i "$i" -e "1 s^.*/env[ ]*python^#! $python^"
+        fi
+        
         if head -n1 "$i" | grep -q /python; then
             echo "wrapping \`$i'..."
             wrapProgram "$i" \

Modified: nixpkgs/branches/modular-python/pkgs/servers/gpsd/default.nix
==============================================================================
--- nixpkgs/branches/modular-python/pkgs/servers/gpsd/default.nix       Mon Mar 
28 16:48:31 2011        (r26582)
+++ nixpkgs/branches/modular-python/pkgs/servers/gpsd/default.nix       Mon Mar 
28 17:19:27 2011        (r26583)
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, python, pkgconfig, dbus, dbus_glib
-, ncurses, libX11, libXt, libXpm, libXaw, libXext, makeWrapper
-, libxslt, xmlto, gpsdUser ? "gpsd" }:
+, ncurses, libX11, libXt, libXpm, libXaw, libXext, wrapPython
+, libxslt, xmlto, gpsdUser ? "gpsd", pythonPackages }:
 
 stdenv.mkDerivation rec {
   name = "gpsd-2.39";
@@ -13,28 +13,18 @@
   buildInputs = [
     python pkgconfig dbus dbus_glib ncurses
     libX11 libXt libXpm libXaw libXext
-    makeWrapper libxslt xmlto
+    wrapPython libxslt xmlto
   ];
 
-  configureFlags = "--enable-dbus --enable-gpsd-user=${gpsdUser} "
+  pythonPath = [ pythonPackages.curses ];
 
+  configureFlags = "--enable-dbus --enable-gpsd-user=${gpsdUser} "
     # Make sure `xgpsspeed' has libXt and libX11 in its RPATH.
     + "LDFLAGS=-Wl,--rpath=${libXt}/lib:${libX11}/lib";
 
   doCheck = true;
 
-  postInstall = ''
-    for prog in "$out/bin"/*
-    do
-      if grep -q python "$prog"
-      then
-          echo "patching \`$prog'..."
-          wrapProgram "$prog"                                                  
 \
-            --prefix PATH ":" "${python}/bin"                                  
 \
-            --prefix PYTHONPATH ":" 
"$out/lib/${python.libPrefix}/site-packages"
-      fi
-    done
-  '';
+  postInstall = "wrapPythonPrograms";
 
   meta = {
     description = "`gpsd', a GPS service daemon";

Modified: nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix
==============================================================================
--- nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix     Mon Mar 
28 16:48:31 2011        (r26582)
+++ nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix     Mon Mar 
28 17:19:27 2011        (r26583)
@@ -6017,10 +6017,7 @@
 
   gpscorrelate = callPackage ../applications/misc/gpscorrelate { };
 
-  gpsd = callPackage ../servers/gpsd {
-    # We need a Python with NCurses bindings.
-    python = pythonFull;
-  };
+  gpsd = callPackage ../servers/gpsd { };
 
   guitone = callPackage ../applications/version-management/guitone { };
 
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to