anki-bin: 24.06.3 -> 24.11 (#360722)
[NixPkgs.git] / pkgs / development / python-modules / mat2 / default.nix
blobf942fadb403f72f0900c236258463dba9b629a21
2   lib,
3   stdenv,
4   buildPythonPackage,
5   pytestCheckHook,
6   pythonOlder,
7   fetchFromGitLab,
8   substituteAll,
9   bubblewrap,
10   exiftool,
11   ffmpeg,
12   wrapGAppsHook3,
13   gdk-pixbuf,
14   gobject-introspection,
15   librsvg,
16   poppler_gi,
17   mutagen,
18   pygobject3,
19   pycairo,
20   dolphinIntegration ? false,
21   plasma5Packages,
24 buildPythonPackage rec {
25   pname = "mat2";
26   version = "0.13.4";
28   disabled = pythonOlder "3.5";
30   format = "setuptools";
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   };
40   patches =
41     [
42       # hardcode paths to some binaries
43       (substituteAll (
44         {
45           src = ./paths.patch;
46           exiftool = "${exiftool}/bin/exiftool";
47           ffmpeg = "${ffmpeg}/bin/ffmpeg";
48         }
49         // lib.optionalAttrs dolphinIntegration { kdialog = "${plasma5Packages.kdialog}/bin/kdialog"; }
50       ))
51       # the executable shouldn't be called .mat2-wrapped
52       ./executable-name.patch
53       # hardcode path to mat2 executable
54       ./tests.patch
55     ]
56     ++ lib.optionals (stdenv.hostPlatform.isLinux) [
57       (substituteAll {
58         src = ./bubblewrap-path.patch;
59         bwrap = "${bubblewrap}/bin/bwrap";
60       })
61     ];
63   postPatch = ''
64     rm pyproject.toml
65     substituteInPlace dolphin/mat2.desktop \
66       --replace "@mat2@" "$out/bin/mat2" \
67       --replace "@mat2svg@" "$out/share/icons/hicolor/scalable/apps/mat2.svg"
68   '';
70   nativeBuildInputs = [
71     gobject-introspection
72     wrapGAppsHook3
73   ];
75   buildInputs = [
76     gdk-pixbuf
77     librsvg
78     poppler_gi
79   ];
81   propagatedBuildInputs = [
82     mutagen
83     pygobject3
84     pycairo
85   ];
87   postInstall =
88     ''
89       install -Dm 444 data/mat2.svg -t "$out/share/icons/hicolor/scalable/apps"
90       install -Dm 444 doc/mat2.1 -t "$out/share/man/man1"
91     ''
92     + lib.optionalString dolphinIntegration ''
93       install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus"
94     '';
96   nativeCheckInputs = [ pytestCheckHook ];
98   disabledTests = [
99     # libmat2.pdf.cairo.MemoryError: out of memory
100     "test_all"
101   ];
103   meta = with lib; {
104     description = "Handy tool to trash your metadata";
105     homepage = "https://0xacab.org/jvoisin/mat2";
106     changelog = "https://0xacab.org/jvoisin/mat2/-/blob/${version}/CHANGELOG.md";
107     license = licenses.lgpl3Plus;
108     mainProgram = "mat2";
109     maintainers = with maintainers; [ dotlambda ];
110   };