1{ lib, stdenv, fetchurl, fetchpatch, python, buildPythonPackage, pkg-config, glib, isPy3k, pythonAtLeast }: 2 3buildPythonPackage rec { 4 pname = "pygobject"; 5 version = "2.28.7"; 6 format = "other"; 7 disabled = pythonAtLeast "3.9"; 8 9 src = fetchurl { 10 url = "mirror://gnome/sources/pygobject/2.28/${pname}-${version}.tar.xz"; 11 sha256 = "0nkam61rsn7y3wik3vw46wk5q2cjfh2iph57hl9m39rc8jijb7dv"; 12 }; 13 14 outputs = [ "out" "devdoc" ]; 15 16 patches = lib.optionals stdenv.isDarwin [ 17 ./pygobject-2.0-fix-darwin.patch 18 (fetchpatch { 19 url = "https://github.com/macports/macports-ports/raw/f2975d5bbbc2459c661905c5a850cc661fa32f55/python/py-gobject/files/py-gobject-dynamic_lookup-11.patch"; 20 sha256 = "sha256-mtlyu+La3+iC5iQAmVJzDA5E35XGaRQy/EKXzvrWRCg="; 21 extraPrefix = ""; 22 }) 23 ]; 24 25 configureFlags = [ "--disable-introspection" ]; 26 27 nativeBuildInputs = [ pkg-config ]; 28 buildInputs = [ glib ]; 29 30 # in a "normal" setup, pygobject and pygtk are installed into the 31 # same site-packages: we need a pth file for both. pygtk.py would be 32 # used to select a specific version, in our setup it should have no 33 # effect, but we leave it in case somebody expects and calls it. 34 postInstall = lib.optionalString (!isPy3k) '' 35 mv $out/lib/${python.libPrefix}/site-packages/{pygtk.pth,${pname}-${version}.pth} 36 37 # Prevent wrapping of codegen files as these are meant to be 38 # executed by the python program 39 chmod a-x $out/share/pygobject/*/codegen/*.py 40 ''; 41 42 meta = with lib; { 43 homepage = "https://pygobject.readthedocs.io/"; 44 description = "Python bindings for GLib"; 45 platforms = platforms.unix; 46 }; 47}