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.48.2";
22
23 outputs = [
24 "out"
25 "dev"
26 ];
27
28 disabled = pythonOlder "3.8";
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-B5SutKm+MaCSrCBiG19U7CgPkYWUPTKLEFza5imK0ac=";
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 ] ++ lib.optionals stdenv.isDarwin [ ncurses ];
50
51 propagatedBuildInputs = [
52 pycairo
53 gobject-introspection # e.g. try building: python3Packages.urwid python3Packages.pydbus
54 ];
55
56 mesonFlags = [
57 # This is only used for figuring out what version of Python is in
58 # use, and related stuff like figuring out what the install prefix
59 # should be, but it does need to be able to execute Python code.
60 "-Dpython=${python.pythonOnBuildForHost.interpreter}"
61 ];
62
63 passthru = {
64 updateScript = gnome.updateScript {
65 packageName = pname;
66 attrPath = "python3.pkgs.${pname}3";
67 versionPolicy = "odd-unstable";
68 };
69 };
70
71 meta = with lib; {
72 homepage = "https://pygobject.readthedocs.io/";
73 description = "Python bindings for Glib";
74 license = licenses.lgpl21Plus;
75 maintainers = with maintainers; [ jtojnar ];
76 platforms = platforms.unix;
77 };
78}