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