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.26.0";
18
19 disabled = pythonOlder "3.6";
20
21 format = "other";
22
23 src = fetchFromGitHub {
24 owner = "pygobject";
25 repo = "pycairo";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-AUnMPsGFkCgVKUdQfym35ZqrA48wq31BNsvc2puoCl8=";
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 mesonFlags = [
41 # This is only used for figuring out what version of Python is in
42 # use, and related stuff like figuring out what the install prefix
43 # should be, but it does need to be able to execute Python code.
44 "-Dpython=${python.pythonOnBuildForHost.interpreter}"
45 ];
46
47 meta = with lib; {
48 description = "Python 3 bindings for cairo";
49 homepage = "https://pycairo.readthedocs.io/";
50 license = with licenses; [
51 lgpl21Only
52 mpl11
53 ];
54 platforms = lib.platforms.linux ++ lib.platforms.darwin;
55 };
56}