1{
2 lib,
3 pythonOlder,
4 fetchFromGitHub,
5 meson,
6 ninja,
7 buildPythonPackage,
8 pytestCheckHook,
9 pkg-config,
10 cairo,
11 libxcrypt,
12 python,
13}:
14
15buildPythonPackage rec {
16 pname = "pycairo";
17 version = "1.28.0";
18
19 disabled = pythonOlder "3.6";
20
21 format = "other";
22
23 src = fetchFromGitHub {
24 owner = "pygobject";
25 repo = "pycairo";
26 tag = "v${version}";
27 hash = "sha256-OAF1Yv9aoUctklGzH2xM+cVu5csyEnX2AV9n0OeoFUw=";
28 };
29
30 nativeBuildInputs = [
31 meson
32 ninja
33 pkg-config
34 ];
35
36 buildInputs = [ cairo ] ++ lib.optionals (pythonOlder "3.9") [ libxcrypt ];
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 # Cairo tries to load system fonts by default.
41 # It's surfaced as a Cairo "out of memory" error in tests.
42 __impureHostDeps = [ "/System/Library/Fonts" ];
43
44 mesonFlags = [
45 # This is only used for figuring out what version of Python is in
46 # use, and related stuff like figuring out what the install prefix
47 # should be, but it does need to be able to execute Python code.
48 "-Dpython=${python.pythonOnBuildForHost.interpreter}"
49 ];
50
51 meta = with lib; {
52 description = "Python 3 bindings for cairo";
53 homepage = "https://pycairo.readthedocs.io/";
54 license = with licenses; [
55 lgpl21Only
56 mpl11
57 ];
58 platforms = platforms.unix;
59 };
60}