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