diff options
author | Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com> | 2015-05-17 19:33:18 +0200 |
---|---|---|
committer | Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com> | 2015-05-17 21:11:36 +0200 |
commit | 393219d00052dc47494d81a9619e25f1152314e5 (patch) | |
tree | 243f07d4194595291d05388596a7eda47f1a5dcd /pkgs/misc/drivers/hplip | |
parent | b549ce1ddd4516118eb802a25a539fdf99b0e69a (diff) | |
download | nixlib-393219d00052dc47494d81a9619e25f1152314e5.tar nixlib-393219d00052dc47494d81a9619e25f1152314e5.tar.gz nixlib-393219d00052dc47494d81a9619e25f1152314e5.tar.bz2 nixlib-393219d00052dc47494d81a9619e25f1152314e5.tar.lz nixlib-393219d00052dc47494d81a9619e25f1152314e5.tar.xz nixlib-393219d00052dc47494d81a9619e25f1152314e5.tar.zst nixlib-393219d00052dc47494d81a9619e25f1152314e5.zip |
hplip: stop installing corrupted tools
None of the installed tools like hp-align or hp-toolbox could work, because they tried to import wrapped Python scripts (i.e. shell code) as Python modules. Fix this by: - Substituting `dbus` for the defective `pythonDBus`. - No longer blindly wrapping all python files, but replacing the original symlinks in $out/bin with wrapper scripts. These wrappers then `exec` the unmodified Python scripts in $out/share/hplip directly, instead of the .<name>-wrapped copy that wrapPythonProgramsIn creates. The latter are simply removed. Sure, it's a bit ugly. It's also 2015 and I couldn't use my printer :-/
Diffstat (limited to 'pkgs/misc/drivers/hplip')
-rw-r--r-- | pkgs/misc/drivers/hplip/default.nix | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix index bb790be7c268..7e5759235c66 100644 --- a/pkgs/misc/drivers/hplip/default.nix +++ b/pkgs/misc/drivers/hplip/default.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl, automake, pkgconfig , cups, zlib, libjpeg, libusb1, pythonPackages, saneBackends, dbus -, polkit, qtSupport ? true, qt4, pythonDBus, pyqt4, net_snmp -, withPlugin ? false, substituteAll +, polkit, qtSupport ? true, qt4, pyqt4, net_snmp +, withPlugin ? false, substituteAll, makeWrapper }: let @@ -74,7 +74,19 @@ stdenv.mkDerivation { postInstall = '' - wrapPythonPrograms + # Wrap the user-facing Python scripts in /bin without turning the ones + # in /share into shell scripts (they need to be importable). + # Complicated by the fact that /bin contains just symlinks to /share. + for bin in $out/bin/*; do + py=`readlink -m $bin` + rm $bin + cp $py $bin + wrapPythonProgramsIn $bin "$out $pythonPath" + sed -i "s@$(dirname $bin)/[^ ]*@$py@g" $bin + done + + # Remove originals. Knows a little too much about wrapPythonProgramsIn. + rm -f $out/bin/.*-wrapped '' + (stdenv.lib.optionalString withPlugin (let hplip_arch = @@ -130,8 +142,8 @@ stdenv.mkDerivation { ] ++ stdenv.lib.optional qtSupport qt4; pythonPath = with pythonPackages; [ + dbus pillow - pythonDBus pygobject recursivePthLoader reportlab @@ -144,6 +156,6 @@ stdenv.mkDerivation { then licenses.unfree else with licenses; [ mit bsd2 gpl2Plus ]; platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" ]; - maintainers = with maintainers; [ ttuegel jgeerds ]; + maintainers = with maintainers; [ ttuegel jgeerds nckx ]; }; } |