mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
python3Packages.mat2: only use bubblewrap on Linux
This commit is contained in:
parent
f443859b72
commit
bf7831578d
35
pkgs/development/python-modules/mat2/bubblewrap-path.patch
Normal file
35
pkgs/development/python-modules/mat2/bubblewrap-path.patch
Normal 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',
|
@ -1,4 +1,5 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, buildPythonPackage
|
||||
, python
|
||||
, pythonOlder
|
||||
@ -37,7 +38,6 @@ buildPythonPackage rec {
|
||||
# hardcode paths to some binaries
|
||||
(substituteAll ({
|
||||
src = ./paths.patch;
|
||||
bwrap = "${bubblewrap}/bin/bwrap";
|
||||
exiftool = "${exiftool}/bin/exiftool";
|
||||
ffmpeg = "${ffmpeg}/bin/ffmpeg";
|
||||
} // lib.optionalAttrs dolphinIntegration {
|
||||
@ -52,6 +52,11 @@ buildPythonPackage rec {
|
||||
src = ./fix_poppler.patch;
|
||||
poppler_path = "${poppler_gi}/lib/girepository-1.0";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isLinux) [
|
||||
(substituteAll {
|
||||
src = ./bubblewrap-path.patch;
|
||||
bwrap = "${bubblewrap}/bin/bwrap";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -12,41 +12,6 @@ index 41c8de4..11df258 100644
|
||||
+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/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',
|
||||
diff --git a/libmat2/exiftool.py b/libmat2/exiftool.py
|
||||
index eb65b2a..51a0fa1 100644
|
||||
--- a/libmat2/exiftool.py
|
||||
|
Loading…
Reference in New Issue
Block a user