gimp: Hardcode interpreter paths

The E (extension) line in pygimp.interp prints the following warnings:

GIMP-Warning: Bad interpreter referenced in interpreter file /nix/store/5c91dah385gn70blsn6i5rzncqj3ks0y-gimp-with-plugins-2.10.18/lib/gimp/2.0/interpreters/pygimp.interp: python2
GIMP-Warning: Bad binary format string in interpreter file /nix/store/5c91dah385gn70blsn6i5rzncqj3ks0y-gimp-with-plugins-2.10.18/lib/gimp/2.0/interpreters/pygimp.interp

This means that the py extension will not be registered when python2 is not in PATH. To prevent this, let’s hardcode the absolute python2 path.

https://github.com/NixOS/nixpkgs/issues/60937#issuecomment-653652093

Closes: https://github.com/NixOS/nixpkgs/issues/60937

+26 -9
+15 -9
pkgs/applications/graphics/gimp/default.nix
··· 2 2 , lib 3 3 , fetchurl 4 4 , substituteAll 5 + , autoreconfHook 5 6 , pkgconfig 6 7 , intltool 7 8 , babl ··· 60 61 sha256 = "4S+fh0saAHxCd7YKqB4LZzML5+YVPldJ6tg5uQL8ezw="; 61 62 }; 62 63 64 + patches = [ 65 + # to remove compiler from the runtime closure, reference was retained via 66 + # gimp --version --verbose output 67 + (substituteAll { 68 + src = ./remove-cc-reference.patch; 69 + cc_version = stdenv.cc.cc.name; 70 + }) 71 + 72 + # Use absolute paths instead of relying on PATH 73 + # to make sure plug-ins are loaded by the correct interpreter. 74 + ./hardcode-plugin-interpreters.patch 75 + ]; 76 + 63 77 nativeBuildInputs = [ 78 + autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am 64 79 pkgconfig 65 80 intltool 66 81 gettext ··· 123 138 # The check runs before glib-networking is registered 124 139 export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES" 125 140 ''; 126 - 127 - patches = [ 128 - # to remove compiler from the runtime closure, reference was retained via 129 - # gimp --version --verbose output 130 - (substituteAll { 131 - src = ./remove-cc-reference.patch; 132 - cc_version = stdenv.cc.cc.name; 133 - }) 134 - ]; 135 141 136 142 postFixup = '' 137 143 wrapProgram $out/bin/gimp-${lib.versions.majorMinor version} \
+11
pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch
··· 1 + --- a/plug-ins/pygimp/Makefile.am 2 + +++ b/plug-ins/pygimp/Makefile.am 3 + @@ -157,7 +157,7 @@ install-interp-file: 4 + echo 'python=$(PYBIN_PATH)' > '$(DESTDIR)$(pyinterpfile)' 5 + echo 'python2=$(PYBIN_PATH)' >> '$(DESTDIR)$(pyinterpfile)' 6 + echo '/usr/bin/python=$(PYBIN_PATH)' >> '$(DESTDIR)$(pyinterpfile)' 7 + - echo ":Python:E::py::`basename $(PYTHON)`:" >> '$(DESTDIR)$(pyinterpfile)' 8 + + echo ":Python:E::py::$(PYTHON):" >> '$(DESTDIR)$(pyinterpfile)' 9 + 10 + install-data-local: install-env-file install-interp-file 11 +