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