pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / development / python2-modules / pycairo / default.nix
blob97fe85a9990759821e446598e8bba6be5aa68620
1 { lib
2 , fetchFromGitHub
3 , fetchpatch
4 , meson
5 , ninja
6 , buildPythonPackage
7 , pytest
8 , pkg-config
9 , cairo
10 , python
13 buildPythonPackage rec {
14   pname = "pycairo";
15   version = "1.18.2";
17   format = "other";
19   src = fetchFromGitHub {
20     owner = "pygobject";
21     repo = "pycairo";
22     rev = "v${version}";
23     sha256 = "142145a2whvlk92jijrbf3i2bqrzmspwpysj0bfypw0krzi0aa6j";
24   };
26   patches = [
27     (fetchpatch {
28       url = "https://github.com/pygobject/pycairo/commit/678edd94d8a6dfb5d51f9c3549e6ee8c90a73744.patch";
29       sha256 = "sha256-HmP69tUGYxZvJ/M9FJHwHTCjb9Kf4aWRyMT4wSymrT0=";
30     })
31   ];
33   nativeBuildInputs = [
34     meson
35     ninja
36     pkg-config
37   ];
39   buildInputs = [
40     cairo
41   ];
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   '';
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   ];
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   };