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