summary refs log tree commit diff
path: root/pkgs/applications/audio/gpodder/default.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-02-15 14:16:01 +0100
committeraszlig <aszlig@redmoonstudios.org>2016-02-15 14:24:11 +0100
commitd9470c9e194ba612133498d8b4259a6e23cb1d6a (patch)
tree8bb0d67aef0590a6e919203772d2b2bcc47eb67d /pkgs/applications/audio/gpodder/default.nix
parentfb1b8464f87a502603e07228aeee0e1a00dba145 (diff)
downloadnixpkgs-d9470c9e194ba612133498d8b4259a6e23cb1d6a.tar
nixpkgs-d9470c9e194ba612133498d8b4259a6e23cb1d6a.tar.gz
nixpkgs-d9470c9e194ba612133498d8b4259a6e23cb1d6a.tar.bz2
nixpkgs-d9470c9e194ba612133498d8b4259a6e23cb1d6a.tar.lz
nixpkgs-d9470c9e194ba612133498d8b4259a6e23cb1d6a.tar.xz
nixpkgs-d9470c9e194ba612133498d8b4259a6e23cb1d6a.tar.zst
nixpkgs-d9470c9e194ba612133498d8b4259a6e23cb1d6a.zip
gpodder: Clean up package expression
We don't need to wrap twice, because we can actually pass the additional
XDG_DATA_DIRS via makeWrapperArgs.

The reason why I'm doing this within the patchPhase is because we can't
add shell variables from the current builder to makeWrapperArgs as that
content is going to end up in the wrapper verbatim.

In addition to this, gpodder was trying to search for its own directory
using the current program name, which I guess was another reason for the
double-wrap. We fix this now by setting gpodder_dir explicitly in the
main script.

Another main change is that we no longer set the "pythonX.Y-" prefix, so
the derivation name now is just "gpodder-3.9.0".

Last but not least, we enable the unit tests for gpodder in checkPhase.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @svenkeidel
Diffstat (limited to 'pkgs/applications/audio/gpodder/default.nix')
-rw-r--r--pkgs/applications/audio/gpodder/default.nix55
1 files changed, 24 insertions, 31 deletions
diff --git a/pkgs/applications/audio/gpodder/default.nix b/pkgs/applications/audio/gpodder/default.nix
index 216259deb43..55337bf1d3a 100644
--- a/pkgs/applications/audio/gpodder/default.nix
+++ b/pkgs/applications/audio/gpodder/default.nix
@@ -1,50 +1,43 @@
-{ pkgs, stdenv, fetchurl, python, buildPythonPackage, pythonPackages, mygpoclient, intltool,
-  ipodSupport ? true, libgpod, gnome3 }:
+{ stdenv, fetchurl, buildPythonPackage, pythonPackages, mygpoclient, intltool
+, ipodSupport ? true, libgpod
+, gnome3
+}:
 
-with pkgs.lib;
+buildPythonPackage rec {
+  name = "gpodder-${version}";
+  namePrefix = "";
 
-let
-  inherit (pythonPackages) coverage feedparser minimock sqlite3 dbus pygtk eyeD3;
-
-in buildPythonPackage rec {
-  name = "gpodder-3.9.0";
+  version = "3.9.0";
 
   src = fetchurl {
     url = "http://gpodder.org/src/${name}.tar.gz";
     sha256 = "1ik954idi0ldnw0wrv7mm71smyb6x66332jxcaf1dxsl12ccm44l";
   };
 
+  postPatch = with stdenv.lib; ''
+    sed -i -re 's,^( *gpodder_dir *= *).*,\1"'"$out"'",' bin/gpodder
+
+    makeWrapperArgs="--suffix XDG_DATA_DIRS : '${concatStringsSep ":" [
+      "${gnome3.gnome_themes_standard}/share"
+      "$XDG_ICON_DIRS"
+      "$GSETTINGS_SCHEMAS_PATH"
+    ]}'"
+  '';
+
   buildInputs = [
-    coverage minimock sqlite3 mygpoclient intltool
+    intltool pythonPackages.coverage pythonPackages.minimock
     gnome3.gnome_themes_standard gnome3.defaultIconTheme
     gnome3.gsettings_desktop_schemas
   ];
 
-  propagatedUserEnvPkgs = [ gnome3.gnome_themes_standard ];
-
-  pythonPath = [ feedparser dbus mygpoclient sqlite3 pygtk eyeD3 ]
-    ++ stdenv.lib.optional ipodSupport libgpod;
+  propagatedBuildInputs = with pythonPackages; [
+    feedparser dbus mygpoclient sqlite3 pygtk eyeD3
+  ] ++ stdenv.lib.optional ipodSupport libgpod;
 
-  postPatch = "sed -ie 's/PYTHONPATH=src/PYTHONPATH=\$(PYTHONPATH):src/' makefile";
-
-  preFixup = ''
-    wrapProgram $out/bin/gpodder \
-      --prefix XDG_DATA_DIRS : "${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"
+  checkPhase = ''
+    LC_ALL=C python -m gpodder.unittests
   '';
 
-  # The `wrapPythonPrograms` script in the postFixup phase breaks gpodder. The
-  # easiest way to fix this is to call wrapPythonPrograms and then to clean up
-  # the wrapped file.
-  postFixup = ''
-    wrapPythonPrograms
-
-    sed -i "$out/bin/..gpodder-wrapped-wrapped" -e '{
-        /import sys; sys.argv/d
-    }'
-  '';
-
-  installPhase = "DESTDIR=/ PREFIX=$out make install";
-
   meta = {
     description = "A podcatcher written in python";
     longDescription = ''