Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 119 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch2, 7 8 # build-system 9 cmake, 10 nasm, 11 pkg-config, 12 setuptools, 13 14 # native dependencies 15 libheif, 16 libaom, 17 libde265, 18 x265, 19 20 # dependencies 21 pillow, 22 23 # tests 24 opencv4, 25 numpy, 26 pympler, 27 pytestCheckHook, 28}: 29 30buildPythonPackage rec { 31 pname = "pillow-heif"; 32 version = "0.17.0"; 33 pyproject = true; 34 35 src = fetchFromGitHub { 36 owner = "bigcat88"; 37 repo = "pillow_heif"; 38 rev = "refs/tags/v${version}"; 39 hash = "sha256-fKh4UbTVj74YxH2vvL24DNmMxg10GSYAmduwuRneE+0="; 40 }; 41 42 patches = [ 43 (fetchpatch2 { 44 # fix libheif 1.18 support in tests 45 url = "https://github.com/bigcat88/pillow_heif/commit/a59434e9ca1138e47e322ddef2adc79e684384f1.patch"; 46 hash = "sha256-yVT/pnO5KWMnsO95EPCZgyhx6FIJOhsna7t0zpTjWpE="; 47 }) 48 ]; 49 50 postPatch = '' 51 sed -i '/addopts/d' pyproject.toml 52 ''; 53 54 nativeBuildInputs = [ 55 cmake 56 nasm 57 pkg-config 58 setuptools 59 ]; 60 61 dontUseCmakeConfigure = true; 62 63 buildInputs = [ 64 libaom 65 libde265 66 libheif 67 x265 68 ]; 69 70 env = { 71 # clang-16: error: argument unused during compilation: '-fno-strict-overflow' 72 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument"; 73 74 RELEASE_FULL_FLAG = 1; 75 }; 76 77 propagatedBuildInputs = [ pillow ]; 78 79 pythonImportsCheck = [ "pillow_heif" ]; 80 81 nativeCheckInputs = [ 82 opencv4 83 numpy 84 pympler 85 pytestCheckHook 86 ]; 87 88 disabledTests = 89 [ 90 # Time based 91 "test_decode_threads" 92 ] 93 ++ lib.optionals stdenv.isDarwin [ 94 # https://github.com/bigcat88/pillow_heif/issues/89 95 # not reproducible in nixpkgs 96 "test_opencv_crash" 97 ] 98 ++ lib.optionals (stdenv.isLinux && stdenv.isAarch64) [ 99 # RuntimeError: Encoder plugin generated an error: Unsupported bit depth: Bit depth not supported by x265 100 "test_open_heif_compare_non_standard_modes_data" 101 "test_open_save_disable_16bit" 102 "test_save_bgr_16bit_to_10_12_bit" 103 "test_save_bgra_16bit_to_10_12_bit" 104 "test_premultiplied_alpha" 105 "test_hdr_save" 106 "test_I_color_modes_to_10_12_bit" 107 ]; 108 109 meta = { 110 changelog = "https://github.com/bigcat88/pillow_heif/releases/tag/v${version}"; 111 description = "Python library for working with HEIF images and plugin for Pillow"; 112 homepage = "https://github.com/bigcat88/pillow_heif"; 113 license = with lib.licenses; [ 114 bsd3 115 lgpl3 116 ]; 117 maintainers = with lib.maintainers; [ dandellion ]; 118 }; 119}