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