1{ lib
2, stdenv
3, fetchurl
4, buildPythonPackage
5, pkg-config
6, glib
7, gobject-introspection
8, pycairo
9, cairo
10, ncurses
11, meson
12, ninja
13, isPy3k
14, gnome
15, python
16}:
17
18buildPythonPackage rec {
19 pname = "pygobject";
20 version = "3.42.2";
21
22 outputs = [ "out" "dev" ];
23
24 disabled = !isPy3k;
25
26 format = "other";
27
28 src = fetchurl {
29 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
30 sha256 = "rehpXipwc4Sd0DFtMdhyjhXh4Lxx2f9tHAnoa+UryVc=";
31 };
32
33 depsBuildBuild = [
34 pkg-config
35 ];
36
37 nativeBuildInputs = [
38 pkg-config
39 meson
40 ninja
41 gobject-introspection
42 ];
43
44 buildInputs = [
45 # # .so files link to these
46 gobject-introspection
47 glib
48 ] ++ lib.optionals stdenv.isDarwin [
49 ncurses
50 ];
51
52 propagatedBuildInputs = [
53 pycairo
54 cairo
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.pythonForBuild.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}