at 22.05-pre 2.5 kB view raw
1{ lib, stdenv, fetchurl, fetchpatch, python, pkg-config, gtk2, pygobject2, pycairo, pango 2, buildPythonPackage, libglade ? null, isPy3k }: 3 4buildPythonPackage rec { 5 pname = "pygtk"; 6 version = "2.24.0"; 7 8 disabled = isPy3k; 9 10 src = fetchurl { 11 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2"; 12 sha256 = "04k942gn8vl95kwf0qskkv6npclfm31d78ljkrkgyqxxcni1w76d"; 13 }; 14 15 patches = [ 16 # https://bugzilla.gnome.org/show_bug.cgi?id=660216 - fixes some memory leaks 17 (fetchpatch { 18 url = "https://gitlab.gnome.org/Archive/pygtk/commit/eca72baa5616fbe4dbebea43c7e5940847dc5ab8.diff"; 19 sha256 = "031px4w5cshcx1sns430sdbr2i007b9zyb2carb3z65nzr77dpdd"; 20 }) 21 (fetchpatch { 22 url = "https://gitlab.gnome.org/Archive/pygtk/commit/4aaa48eb80c6802aec6d03e5695d2a0ff20e0fc2.patch"; 23 sha256 = "0z8cg7nr3qki8gg8alasdzzyxcihfjlxn518glq5ajglk3q5pzsn"; 24 }) 25 ]; 26 27 nativeBuildInputs = [ pkg-config ]; 28 buildInputs = [ 29 pango 30 ] ++ lib.optional (libglade != null) libglade; 31 32 propagatedBuildInputs = [ gtk2 pygobject2 pycairo ]; 33 34 configurePhase = "configurePhase"; 35 36 buildPhase = "buildPhase"; 37 38 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-ObjC"; 39 40 installPhase = "installPhase"; 41 42 checkPhase = lib.optionalString (libglade == null) 43 '' 44 sed -i -e "s/glade = importModule('gtk.glade', buildDir)//" \ 45 tests/common.py 46 sed -i -e "s/, glade$//" \ 47 -e "s/.*testGlade.*//" \ 48 -e "s/.*(glade.*//" \ 49 tests/test_api.py 50 '' + '' 51 sed -i -e "s/sys.path.insert(0, os.path.join(buildDir, 'gtk'))//" \ 52 -e "s/sys.path.insert(0, buildDir)//" \ 53 tests/common.py 54 make check 55 ''; 56 # XXX: TypeError: Unsupported type: <class 'gtk._gtk.WindowType'> 57 # The check phase was not executed in the previous 58 # non-buildPythonPackage setup - not sure why not. 59 doCheck = false; 60 61 postInstall = '' 62 rm $out/bin/pygtk-codegen-2.0 63 ln -s ${pygobject2}/bin/pygobject-codegen-2.0 $out/bin/pygtk-codegen-2.0 64 ln -s ${pygobject2}/lib/${python.libPrefix}/site-packages/pygobject-${pygobject2.version}.pth \ 65 $out/lib/${python.libPrefix}/site-packages/${pname}-${version}.pth 66 ''; 67 68 meta = with lib; { 69 description = "GTK 2 Python bindings"; 70 homepage = "https://gitlab.gnome.org/Archive/pygtk"; 71 platforms = platforms.all; 72 license = with licenses; [ lgpl21Plus ]; 73 }; 74}