1{ stdenv, fetchurl, python, pkgconfig, gtk, pygobject, pycairo
2, buildPythonPackage, libglade ? null, isPy3k }:
3
4buildPythonPackage rec {
5 name = "pygtk-2.24.0";
6
7 disabled = isPy3k;
8
9 src = fetchurl {
10 url = "mirror://gnome/sources/pygtk/2.24/${name}.tar.bz2";
11 sha256 = "04k942gn8vl95kwf0qskkv6npclfm31d78ljkrkgyqxxcni1w76d";
12 };
13
14 buildInputs = [ pkgconfig ]
15 ++ stdenv.lib.optional (libglade != null) libglade;
16
17 propagatedBuildInputs = [ gtk pygobject pycairo ];
18
19 configurePhase = "configurePhase";
20
21 buildPhase = "buildPhase";
22
23 installPhase = "installPhase";
24
25 checkPhase = stdenv.lib.optionalString (libglade == null)
26 ''
27 sed -i -e "s/glade = importModule('gtk.glade', buildDir)//" \
28 tests/common.py
29 sed -i -e "s/, glade$//" \
30 -e "s/.*testGlade.*//" \
31 -e "s/.*(glade.*//" \
32 tests/test_api.py
33 '' + ''
34 sed -i -e "s/sys.path.insert(0, os.path.join(buildDir, 'gtk'))//" \
35 -e "s/sys.path.insert(0, buildDir)//" \
36 tests/common.py
37 make check
38 '';
39 # XXX: TypeError: Unsupported type: <class 'gtk._gtk.WindowType'>
40 # The check phase was not executed in the previous
41 # non-buildPythonPackage setup - not sure why not.
42 doCheck = false;
43
44 postInstall = ''
45 rm $out/bin/pygtk-codegen-2.0
46 ln -s ${pygobject}/bin/pygobject-codegen-2.0 $out/bin/pygtk-codegen-2.0
47 ln -s ${pygobject}/lib/${python.libPrefix}/site-packages/${pygobject.name}.pth \
48 $out/lib/${python.libPrefix}/site-packages/${name}.pth
49 '';
50}