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 :-/
This commit is contained in:
Tobias Geerinckx-Rice 2015-05-17 19:33:18 +02:00
parent b549ce1ddd
commit 393219d000

View File

@ -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 ];
};
}