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