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