Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / pillow-heif / default.nix
blob1d0505e22ed58691d64352519e73ea6085758bd2
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , fetchFromGitHub
6 # build-system
7 , cmake
8 , nasm
10 # native dependencies
11 , libheif
12 , libaom
13 , libde265
14 , x265
16 # dependencies
17 , pillow
19 # tests
20 , opencv4
21 , numpy
22 , pympler
23 , pytestCheckHook
26 buildPythonPackage rec {
27   pname = "pillow-heif";
28   version = "0.13.0";
29   format = "setuptools";
31   src = fetchFromGitHub {
32     owner = "bigcat88";
33     repo = "pillow_heif";
34     rev = "refs/tags/v${version}";
35     hash = "sha256-GbOW29rGpLMS7AfShuO6UCzcspdHtFS7hyNKori0otI=";
36   };
38   postPatch = ''
39     sed -i '/addopts/d' pyproject.toml
40   '';
42   nativeBuildInputs = [
43     cmake
44     nasm
45   ];
47   dontUseCmakeConfigure = true;
49   buildInputs = [
50     libaom
51     libde265
52     libheif
53     x265
54   ];
56   propagatedBuildInputs = [
57     pillow
58   ];
60   pythonImportsCheck = [
61     "pillow_heif"
62   ];
64   nativeCheckInputs = [
65     opencv4
66     numpy
67     pympler
68     pytestCheckHook
69   ];
71   disabledTests = lib.optionals stdenv.isDarwin [
72     # https://github.com/bigcat88/pillow_heif/issues/89
73     # not reproducible in nixpkgs
74     "test_opencv_crash"
75   ] ++ lib.optionals (stdenv.isLinux && stdenv.isAarch64) [
76     # RuntimeError: Encoder plugin generated an error: Unsupported bit depth: Bit depth not supported by x265
77     "test_open_heif_compare_non_standard_modes_data"
78     "test_open_save_disable_16bit"
79     "test_save_bgr_16bit_to_10_12_bit"
80     "test_save_bgra_16bit_to_10_12_bit"
81     "test_premultiplied_alpha"
82     "test_hdr_save"
83     "test_I_color_modes_to_10_12_bit"
84   ];
86   meta = {
87     changelog = "https://github.com/bigcat88/pillow_heif/releases/tag/v${version}";
88     description = "Python library for working with HEIF images and plugin for Pillow";
89     homepage = "https://github.com/bigcat88/pillow_heif";
90     license = with lib.licenses; [ bsd3 lgpl3 ];
91     maintainers = with lib.maintainers; [ dandellion ];
92   };