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