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