summary refs log tree commit diff
path: root/pkgs/development/python-modules/pycairo/default.nix
blob: 091ac809a9bb53779829be155e762387cc386f18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ lib, fetchFromGitHub, python, buildPythonPackage, pytest, pkgconfig, cairo, xlibsWrapper, isPyPy }:

buildPythonPackage rec {
  pname = "pycairo";
  version = "1.16.3";

  disabled = isPyPy;

  src = fetchFromGitHub {
    owner = "pygobject";
    repo = "pycairo";
    rev = "v${version}";
    sha256 = "0clk6wrfls3fa1xrn844762qfaw6gs4ivwkrfysidbzmlbxhpngl";
  };

  # We need to create the pkgconfig file but it cannot be installed as a wheel since wheels
  # are supposed to be relocatable and do not support --prefix option
  buildPhase = ''
    ${python.interpreter} setup.py build
  '';

  installPhase = ''
    ${python.interpreter} setup.py install --skip-build --prefix="$out" --optimize=1
  '';

  checkPhase = ''
    ${python.interpreter} setup.py test
  '';

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ python cairo xlibsWrapper ];
  checkInputs = [ pytest ];

  meta.platforms = lib.platforms.linux ++ lib.platforms.darwin;
}