at 24.05-pre 2.4 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, pytestCheckHook 5, pythonOlder 6, fetchFromGitLab 7, substituteAll 8, bubblewrap 9, exiftool 10, ffmpeg 11, mailcap 12, wrapGAppsHook 13, gdk-pixbuf 14, gobject-introspection 15, librsvg 16, poppler_gi 17, mutagen 18, pygobject3 19, pycairo 20, dolphinIntegration ? false 21, plasma5Packages 22}: 23 24buildPythonPackage rec { 25 pname = "mat2"; 26 version = "0.13.4"; 27 28 disabled = pythonOlder "3.5"; 29 30 format = "setuptools"; 31 32 src = fetchFromGitLab { 33 domain = "0xacab.org"; 34 owner = "jvoisin"; 35 repo = "mat2"; 36 rev = version; 37 hash = "sha256-SuN62JjSb5O8gInvBH+elqv/Oe7j+xjCo+dmPBU7jEY="; 38 }; 39 40 patches = [ 41 # hardcode paths to some binaries 42 (substituteAll ({ 43 src = ./paths.patch; 44 exiftool = "${exiftool}/bin/exiftool"; 45 ffmpeg = "${ffmpeg}/bin/ffmpeg"; 46 } // lib.optionalAttrs dolphinIntegration { 47 kdialog = "${plasma5Packages.kdialog}/bin/kdialog"; 48 })) 49 # the executable shouldn't be called .mat2-wrapped 50 ./executable-name.patch 51 # hardcode path to mat2 executable 52 ./tests.patch 53 ] ++ lib.optionals (stdenv.hostPlatform.isLinux) [ 54 (substituteAll { 55 src = ./bubblewrap-path.patch; 56 bwrap = "${bubblewrap}/bin/bwrap"; 57 }) 58 ]; 59 60 postPatch = '' 61 rm pyproject.toml 62 substituteInPlace dolphin/mat2.desktop \ 63 --replace "@mat2@" "$out/bin/mat2" \ 64 --replace "@mat2svg@" "$out/share/icons/hicolor/scalable/apps/mat2.svg" 65 ''; 66 67 nativeBuildInputs = [ 68 gobject-introspection 69 wrapGAppsHook 70 ]; 71 72 buildInputs = [ 73 gdk-pixbuf 74 librsvg 75 poppler_gi 76 ]; 77 78 propagatedBuildInputs = [ 79 mutagen 80 pygobject3 81 pycairo 82 ]; 83 84 postInstall = '' 85 install -Dm 444 data/mat2.svg -t "$out/share/icons/hicolor/scalable/apps" 86 install -Dm 444 doc/mat2.1 -t "$out/share/man/man1" 87 '' + lib.optionalString dolphinIntegration '' 88 install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus" 89 ''; 90 91 nativeCheckInputs = [ pytestCheckHook ]; 92 93 disabledTests = [ 94 # Frequently fails when exiftool is updated and adds support for new metadata. 95 "test_all_parametred" 96 ]; 97 98 meta = with lib; { 99 description = "A handy tool to trash your metadata"; 100 homepage = "https://0xacab.org/jvoisin/mat2"; 101 changelog = "https://0xacab.org/jvoisin/mat2/-/blob/${version}/CHANGELOG.md"; 102 license = licenses.lgpl3Plus; 103 mainProgram = "mat2"; 104 maintainers = with maintainers; [ dotlambda ]; 105 }; 106}