push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
diff --git a/libmat2/bubblewrap.py b/libmat2/bubblewrap.py
index 970d5dd..5d3c0b7 100644
--- a/libmat2/bubblewrap.py
+++ b/libmat2/bubblewrap.py
@@ -22,11 +22,7 @@ CalledProcessError = subprocess.CalledProcessError
def _get_bwrap_path() -> str:
- which_path = shutil.which('bwrap')
- if which_path:
- return which_path
-
- raise RuntimeError("Unable to find bwrap") # pragma: no cover
+ return '@bwrap@'
def _get_bwrap_args(tempdir: str,
@@ -37,16 +33,11 @@ def _get_bwrap_args(tempdir: str,
# XXX: use --ro-bind-try once all supported platforms
# have a bubblewrap recent enough to support it.
- ro_bind_dirs = ['/usr', '/lib', '/lib64', '/bin', '/sbin', '/etc/alternatives', cwd]
+ ro_bind_dirs = ['/nix/store', cwd]
for bind_dir in ro_bind_dirs:
if os.path.isdir(bind_dir): # pragma: no cover
ro_bind_args.extend(['--ro-bind', bind_dir, bind_dir])
- ro_bind_files = ['/etc/ld.so.cache']
- for bind_file in ro_bind_files:
- if os.path.isfile(bind_file): # pragma: no cover
- ro_bind_args.extend(['--ro-bind', bind_file, bind_file])
-
args = ro_bind_args + \
['--dev', '/dev',
'--proc', '/proc',

View File

@@ -0,0 +1,117 @@
{
lib,
stdenv,
buildPythonPackage,
pytestCheckHook,
fetchFromGitLab,
fetchpatch,
replaceVars,
bubblewrap,
exiftool,
ffmpeg,
setuptools,
wrapGAppsHook3,
gdk-pixbuf,
gobject-introspection,
librsvg,
poppler_gi,
mutagen,
pygobject3,
pycairo,
dolphinIntegration ? false,
kdePackages,
}:
buildPythonPackage rec {
pname = "mat2";
version = "0.13.5";
pyproject = true;
src = fetchFromGitLab {
domain = "0xacab.org";
owner = "jvoisin";
repo = "mat2";
tag = version;
hash = "sha256-ivFgH/88DBucZRaO/OMsLlwJCjv/VQXb6AiKWhZ8XH0=";
};
patches = [
(fetchpatch {
name = "exiftool-13.25-compat.patch";
url = "https://0xacab.org/jvoisin/mat2/-/commit/473903b70e1b269a6110242a9c098a10c18554e2.patch";
hash = "sha256-vxxjAFwiTDlcTT3ZlfhOG4rlzBJS+LhLoA++8y2hEok=";
})
(fetchpatch {
name = "fix-test-on-python313.patch";
url = "https://0xacab.org/jvoisin/mat2/-/commit/f07344444d6d2f04a1f93e2954f4910b194bee0c.patch";
hash = "sha256-y756sKkjGO11A2lrRsXAwWgupOZ00u0cDypvkbsiNbY=";
})
(fetchpatch {
name = "fix-test-on-python312.patch";
url = "https://0xacab.org/jvoisin/mat2/-/commit/7a8ea224bc327b8ee929379d577c74968ea1c352.patch";
hash = "sha256-pPiYhoql5WhjhLKvd6y3OnvxORSbXIGCsZMc7UH3i1Q=";
})
# hardcode paths to some binaries
(replaceVars ./paths.patch {
exiftool = lib.getExe exiftool;
ffmpeg = lib.getExe ffmpeg;
kdialog = if dolphinIntegration then lib.getExe kdePackages.kdialog else null;
# replaced in postPatch
mat2 = null;
mat2svg = null;
})
# the executable shouldn't be called .mat2-wrapped
./executable-name.patch
# hardcode path to mat2 executable
./tests.patch
]
++ lib.optionals (stdenv.hostPlatform.isLinux) [
(replaceVars ./bubblewrap-path.patch {
bwrap = lib.getExe bubblewrap;
})
];
postPatch = ''
substituteInPlace dolphin/mat2.desktop \
--replace "@mat2@" "$out/bin/mat2" \
--replace "@mat2svg@" "$out/share/icons/hicolor/scalable/apps/mat2.svg"
'';
build-system = [ setuptools ];
nativeBuildInputs = [
gobject-introspection
wrapGAppsHook3
];
buildInputs = [
gdk-pixbuf
librsvg
poppler_gi
];
dependencies = [
mutagen
pygobject3
pycairo
];
postInstall = ''
install -Dm 444 data/mat2.svg -t "$out/share/icons/hicolor/scalable/apps"
install -Dm 444 doc/mat2.1 -t "$out/share/man/man1"
''
+ lib.optionalString dolphinIntegration ''
install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus"
'';
nativeCheckInputs = [ pytestCheckHook ];
meta = with lib; {
description = "Handy tool to trash your metadata";
homepage = "https://0xacab.org/jvoisin/mat2";
changelog = "https://0xacab.org/jvoisin/mat2/-/blob/${version}/CHANGELOG.md";
license = licenses.lgpl3Plus;
mainProgram = "mat2";
maintainers = with maintainers; [ dotlambda ];
};
}

View File

@@ -0,0 +1,13 @@
diff --git a/mat2 b/mat2
index 3b77e1e..b99a633 100755
--- a/mat2
+++ b/mat2
@@ -46,7 +46,7 @@ def __check_file(filename: str, mode: int = os.R_OK) -> bool:
def create_arg_parser() -> argparse.ArgumentParser:
- parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2')
+ parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2', prog='mat2')
parser.add_argument('-V', '--verbose', action='store_true',
help='show more verbose status information')

View File

@@ -0,0 +1,66 @@
diff --git a/dolphin/mat2.desktop b/dolphin/mat2.desktop
index 41c8de4..11df258 100644
--- a/dolphin/mat2.desktop
+++ b/dolphin/mat2.desktop
@@ -8,6 +8,6 @@ Type=Service
Name=Clean metadata
Name[de]=Metadaten löschen
Name[es]=Limpiar metadatos
-Icon=/usr/share/icons/hicolor/scalable/apps/mat2.svg
-Exec=kdialog --yesno "$( mat2 -s %F )" --title "Clean Metadata?" && mat2 %U
-Exec[de]=kdialog --yesno "$( mat2 -s %F )" --title "Metadaten löschen?" && mat2 %U
+Icon=@mat2svg@
+Exec=@kdialog@ --yesno "$( @mat2@ -s %F )" --title "Clean Metadata?" && @mat2@ %U
+Exec[de]=@kdialog@ --yesno "$( @mat2@ -s %F )" --title "Metadaten löschen?" && @mat2@ %U
diff --git a/libmat2/exiftool.py b/libmat2/exiftool.py
index 2b91ac2..5fcf6e5 100644
--- a/libmat2/exiftool.py
+++ b/libmat2/exiftool.py
@@ -1,8 +1,6 @@
-import functools
import json
import logging
import os
-import shutil
import subprocess
from typing import Union, Set, Dict
@@ -67,14 +65,5 @@ class ExiftoolParser(abstract.AbstractParser):
return False
return True
-@functools.lru_cache(maxsize=None)
def _get_exiftool_path() -> str: # pragma: no cover
- which_path = shutil.which('exiftool')
- if which_path:
- return which_path
-
- # Exiftool on Arch Linux has a weird path
- if os.access('/usr/bin/vendor_perl/exiftool', os.X_OK):
- return '/usr/bin/vendor_perl/exiftool'
-
- raise RuntimeError("Unable to find exiftool")
+ return '@exiftool@'
diff --git a/libmat2/video.py b/libmat2/video.py
index 39059c5..82fe1e7 100644
--- a/libmat2/video.py
+++ b/libmat2/video.py
@@ -1,6 +1,4 @@
import subprocess
-import functools
-import shutil
import logging
from typing import Union, Dict
@@ -135,10 +133,5 @@ class MP4Parser(AbstractFFmpegParser):
}
-@functools.lru_cache(maxsize=None)
def _get_ffmpeg_path() -> str: # pragma: no cover
- which_path = shutil.which('ffmpeg')
- if which_path:
- return which_path
-
- raise RuntimeError("Unable to find ffmpeg")
+ return '@ffmpeg@'

View File

@@ -0,0 +1,18 @@
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index cede642..2d5ad77 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -10,12 +10,7 @@ import glob
from libmat2 import images, parser_factory
-mat2_binary = ['./mat2']
-
-if 'MAT2_GLOBAL_PATH_TESTSUITE' in os.environ:
- # Debian runs tests after installing the package
- # https://0xacab.org/jvoisin/mat2/issues/16#note_153878
- mat2_binary = ['/usr/bin/env', 'mat2']
+mat2_binary = [os.environ['out'] + '/bin/mat2']
class TestHelp(unittest.TestCase):