about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pygtk
diff options
context:
space:
mode:
authorFlorian Friesdorf <flo@chaoflow.net>2013-01-11 17:45:26 +0100
committerFlorian Friesdorf <flo@chaoflow.net>2013-01-11 17:45:26 +0100
commita7a6173a3f77df4faa6cc9b7e082f37537f459c7 (patch)
treeb4769d6258d7cff29a75078ef0ef3d30651eff40 /pkgs/development/python-modules/pygtk
parent59879f6496db062a62574735925a61c6c5473e10 (diff)
downloadnixlib-a7a6173a3f77df4faa6cc9b7e082f37537f459c7.tar
nixlib-a7a6173a3f77df4faa6cc9b7e082f37537f459c7.tar.gz
nixlib-a7a6173a3f77df4faa6cc9b7e082f37537f459c7.tar.bz2
nixlib-a7a6173a3f77df4faa6cc9b7e082f37537f459c7.tar.lz
nixlib-a7a6173a3f77df4faa6cc9b7e082f37537f459c7.tar.xz
nixlib-a7a6173a3f77df4faa6cc9b7e082f37537f459c7.tar.zst
nixlib-a7a6173a3f77df4faa6cc9b7e082f37537f459c7.zip
pygtk in pythonPackages, checks disabled, demo works, relates #223
Previously the checkPhase was not executed. It is now and a couple of
issues with it are seded away.
Diffstat (limited to 'pkgs/development/python-modules/pygtk')
-rw-r--r--pkgs/development/python-modules/pygtk/default.nix43
1 files changed, 26 insertions, 17 deletions
diff --git a/pkgs/development/python-modules/pygtk/default.nix b/pkgs/development/python-modules/pygtk/default.nix
index 81147fff17dc..07d57591f1ac 100644
--- a/pkgs/development/python-modules/pygtk/default.nix
+++ b/pkgs/development/python-modules/pygtk/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, makeWrapper, python, pkgconfig, glib, gtk, pygobject, pycairo
-, libglade ? null }:
+{ stdenv, fetchurl, python, pkgconfig, glib, gtk, pygobject, pycairo
+, buildPythonPackage, libglade ? null }:
 
-stdenv.mkDerivation rec {
+buildPythonPackage rec {
   name = "pygtk-2.22.0";
 
   src = fetchurl {
@@ -10,26 +10,35 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs =
-    [ makeWrapper python pkgconfig glib gtk ]
+    [ pkgconfig glib gtk ]
     ++ stdenv.lib.optional (libglade != null) libglade;
 
   propagatedBuildInputs = [ pygobject pycairo ];
 
+  installCommand = "make install";
+  checkPhase = stdenv.lib.optionalString (libglade == null)
+    ''
+      sed -i -e "s/glade = importModule('gtk.glade', buildDir)//" \
+             tests/common.py
+      sed -i -e "s/, glade$//" \
+             -e "s/.*testGlade.*//" \
+             -e "s/.*(glade.*//" \
+             tests/test_api.py
+    '' + ''
+      sed -i -e "s/sys.path.insert(0, os.path.join(buildDir, 'gtk'))//" \
+             -e "s/sys.path.insert(0, buildDir)//" \
+             tests/common.py
+      make check
+    '';
+  # XXX: TypeError: Unsupported type: <class 'gtk._gtk.WindowType'>
+  # The check phase was not executed in the previous
+  # non-buildPythonPackage setup - not sure why not.
+  doCheck = false;
+
   postInstall = ''
     rm $out/bin/pygtk-codegen-2.0
     ln -s ${pygobject}/bin/pygobject-codegen-2.0  $out/bin/pygtk-codegen-2.0
-
-    # All python code is installed into a "gtk-2.0" sub-directory. That
-    # sub-directory may be useful on systems which share several library
-    # versions in the same prefix, i.e. /usr/local, but on Nix that directory
-    # is useless. Furthermore, its existence makes it very hard to guess a
-    # proper $PYTHONPATH that allows "import gtk" to succeed.
-    cd $(toPythonPath $out)/gtk-2.0
-    for n in *; do
-      ln -s "gtk-2.0/$n" "../$n"
-    done
-
-    wrapProgram $out/bin/pygtk-demo --prefix PYTHONPATH ":" \
-        $(toPythonPath "${pygobject} ${pycairo} $out")
+    ln -s ${pygobject}/lib/${python.libPrefix}/site-packages/${pygobject.name}.pth \
+                  $out/lib/${python.libPrefix}/site-packages/${name}.pth
   '';
 }