* wrapPythonPrograms: rewrite the common "#! .../env python" idiom to
"#! .../python". svn path=/nixpkgs/branches/modular-python/; revision=26583
This commit is contained in:
parent
7b3bda471d
commit
968496e69b
@ -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" \
|
||||
|
@ -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";
|
||||
|
@ -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 { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user