1{ lib, fetchFromGitHub, python, buildPythonPackage, pytest, pkgconfig, cairo, xlibsWrapper, isPyPy }:
2
3buildPythonPackage rec {
4 pname = "pycairo";
5 version = "1.16.3";
6
7 disabled = isPyPy;
8
9 src = fetchFromGitHub {
10 owner = "pygobject";
11 repo = "pycairo";
12 rev = "v${version}";
13 sha256 = "0clk6wrfls3fa1xrn844762qfaw6gs4ivwkrfysidbzmlbxhpngl";
14 };
15
16 # We need to create the pkgconfig file but it cannot be installed as a wheel since wheels
17 # are supposed to be relocatable and do not support --prefix option
18 buildPhase = ''
19 ${python.interpreter} setup.py build
20 '';
21
22 installPhase = ''
23 ${python.interpreter} setup.py install --skip-build --prefix="$out" --optimize=1
24 '';
25
26 checkPhase = ''
27 ${python.interpreter} setup.py test
28 '';
29
30 nativeBuildInputs = [ pkgconfig ];
31 buildInputs = [ python cairo xlibsWrapper ];
32 checkInputs = [ pytest ];
33
34 meta.platforms = lib.platforms.linux ++ lib.platforms.darwin;
35}