forked from mirrors/nixpkgs
* 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() {
|
wrapPythonProgramsIn() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local pythonPath="$2"
|
local pythonPath="$2"
|
||||||
|
local python="$(type -p python)"
|
||||||
local i
|
local i
|
||||||
|
|
||||||
declare -A pythonPathsSeen=()
|
declare -A pythonPathsSeen=()
|
||||||
|
@ -15,6 +16,12 @@ wrapPythonProgramsIn() {
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in $(find "$dir" -type f -perm +0100); do
|
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
|
if head -n1 "$i" | grep -q /python; then
|
||||||
echo "wrapping \`$i'..."
|
echo "wrapping \`$i'..."
|
||||||
wrapProgram "$i" \
|
wrapProgram "$i" \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ fetchurl, stdenv, python, pkgconfig, dbus, dbus_glib
|
{ fetchurl, stdenv, python, pkgconfig, dbus, dbus_glib
|
||||||
, ncurses, libX11, libXt, libXpm, libXaw, libXext, makeWrapper
|
, ncurses, libX11, libXt, libXpm, libXaw, libXext, wrapPython
|
||||||
, libxslt, xmlto, gpsdUser ? "gpsd" }:
|
, libxslt, xmlto, gpsdUser ? "gpsd", pythonPackages }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "gpsd-2.39";
|
name = "gpsd-2.39";
|
||||||
|
@ -13,28 +13,18 @@ stdenv.mkDerivation rec {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
python pkgconfig dbus dbus_glib ncurses
|
python pkgconfig dbus dbus_glib ncurses
|
||||||
libX11 libXt libXpm libXaw libXext
|
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.
|
# Make sure `xgpsspeed' has libXt and libX11 in its RPATH.
|
||||||
+ "LDFLAGS=-Wl,--rpath=${libXt}/lib:${libX11}/lib";
|
+ "LDFLAGS=-Wl,--rpath=${libXt}/lib:${libX11}/lib";
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = "wrapPythonPrograms";
|
||||||
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
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "`gpsd', a GPS service daemon";
|
description = "`gpsd', a GPS service daemon";
|
||||||
|
|
|
@ -6017,10 +6017,7 @@ let
|
||||||
|
|
||||||
gpscorrelate = callPackage ../applications/misc/gpscorrelate { };
|
gpscorrelate = callPackage ../applications/misc/gpscorrelate { };
|
||||||
|
|
||||||
gpsd = callPackage ../servers/gpsd {
|
gpsd = callPackage ../servers/gpsd { };
|
||||||
# We need a Python with NCurses bindings.
|
|
||||||
python = pythonFull;
|
|
||||||
};
|
|
||||||
|
|
||||||
guitone = callPackage ../applications/version-management/guitone { };
|
guitone = callPackage ../applications/version-management/guitone { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue