From 968496e69bdd4de62fd447f88da2660bd144735f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 28 Mar 2011 17:19:27 +0000 Subject: [PATCH] * wrapPythonPrograms: rewrite the common "#! .../env python" idiom to "#! .../python". svn path=/nixpkgs/branches/modular-python/; revision=26583 --- .../python-modules/generic/wrap.sh | 7 ++++++ pkgs/servers/gpsd/default.nix | 22 +++++-------------- pkgs/top-level/all-packages.nix | 5 +---- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/pkgs/development/python-modules/generic/wrap.sh b/pkgs/development/python-modules/generic/wrap.sh index 98162c8807f7..fb20c5fd7233 100644 --- a/pkgs/development/python-modules/generic/wrap.sh +++ b/pkgs/development/python-modules/generic/wrap.sh @@ -5,6 +5,7 @@ wrapPythonPrograms() { wrapPythonProgramsIn() { local dir="$1" local pythonPath="$2" + local python="$(type -p python)" local i declare -A pythonPathsSeen=() @@ -15,6 +16,12 @@ wrapPythonProgramsIn() { 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" \ diff --git a/pkgs/servers/gpsd/default.nix b/pkgs/servers/gpsd/default.nix index 067e7c4446b2..c531eafa05a6 100644 --- a/pkgs/servers/gpsd/default.nix +++ b/pkgs/servers/gpsd/default.nix @@ -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 @@ stdenv.mkDerivation rec { 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"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c9553be74333..e13a998c35a2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6017,10 +6017,7 @@ let 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 { };