1{
2 lib,
3 stdenv,
4 fetchurl,
5 buildPythonPackage,
6 pkg-config,
7 glib,
8 gobject-introspection,
9 pycairo,
10 cairo,
11 ncurses,
12 meson,
13 ninja,
14 pythonOlder,
15 gnome,
16 python,
17}:
18
19buildPythonPackage rec {
20 pname = "pygobject";
21 version = "3.50.0";
22
23 outputs = [
24 "out"
25 "dev"
26 ];
27
28 disabled = pythonOlder "3.9";
29
30 format = "other";
31
32 src = fetchurl {
33 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
34 hash = "sha256-jYNudbWogdRX7hYiyuSjK826KKC6ViGTrbO7tHJHIhI=";
35 };
36
37 depsBuildBuild = [ pkg-config ];
38
39 nativeBuildInputs = [
40 pkg-config
41 meson
42 ninja
43 gobject-introspection
44 ];
45
46 buildInputs = [
47 cairo
48 glib
49 ]
50 ++ lib.optionals stdenv.hostPlatform.isDarwin [ ncurses ];
51
52 propagatedBuildInputs = [
53 pycairo
54 gobject-introspection # e.g. try building: python3Packages.urwid python3Packages.pydbus
55 ];
56
57 mesonFlags = [
58 # This is only used for figuring out what version of Python is in
59 # use, and related stuff like figuring out what the install prefix
60 # should be, but it does need to be able to execute Python code.
61 "-Dpython=${python.pythonOnBuildForHost.interpreter}"
62 ];
63
64 passthru = {
65 updateScript = gnome.updateScript {
66 packageName = pname;
67 attrPath = "python3.pkgs.${pname}3";
68 versionPolicy = "odd-unstable";
69 };
70 };
71
72 meta = with lib; {
73 homepage = "https://pygobject.readthedocs.io/";
74 description = "Python bindings for Glib";
75 license = licenses.lgpl21Plus;
76 maintainers = with maintainers; [ jtojnar ];
77 platforms = platforms.unix;
78 };
79}