1{ lib, stdenv, fetchurl, 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 ]; 19 20 configureFlags = [ "--disable-introspection" ]; 21 22 nativeBuildInputs = [ pkg-config ]; 23 buildInputs = [ glib ]; 24 25 # in a "normal" setup, pygobject and pygtk are installed into the 26 # same site-packages: we need a pth file for both. pygtk.py would be 27 # used to select a specific version, in our setup it should have no 28 # effect, but we leave it in case somebody expects and calls it. 29 postInstall = lib.optionalString (!isPy3k) '' 30 mv $out/lib/${python.libPrefix}/site-packages/{pygtk.pth,${pname}-${version}.pth} 31 32 # Prevent wrapping of codegen files as these are meant to be 33 # executed by the python program 34 chmod a-x $out/share/pygobject/*/codegen/*.py 35 ''; 36 37 meta = with lib; { 38 homepage = "https://pygobject.readthedocs.io/"; 39 description = "Python bindings for GLib"; 40 platforms = platforms.unix; 41 }; 42}