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