mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 07:01:54 +00:00
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:
parent
b549ce1ddd
commit
393219d000
@ -1,7 +1,7 @@
|
|||||||
{ stdenv, fetchurl, automake, pkgconfig
|
{ stdenv, fetchurl, automake, pkgconfig
|
||||||
, cups, zlib, libjpeg, libusb1, pythonPackages, saneBackends, dbus
|
, cups, zlib, libjpeg, libusb1, pythonPackages, saneBackends, dbus
|
||||||
, polkit, qtSupport ? true, qt4, pythonDBus, pyqt4, net_snmp
|
, polkit, qtSupport ? true, qt4, pyqt4, net_snmp
|
||||||
, withPlugin ? false, substituteAll
|
, withPlugin ? false, substituteAll, makeWrapper
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -74,7 +74,19 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
postInstall =
|
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
|
+ (stdenv.lib.optionalString withPlugin
|
||||||
(let hplip_arch =
|
(let hplip_arch =
|
||||||
@ -130,8 +142,8 @@ stdenv.mkDerivation {
|
|||||||
] ++ stdenv.lib.optional qtSupport qt4;
|
] ++ stdenv.lib.optional qtSupport qt4;
|
||||||
|
|
||||||
pythonPath = with pythonPackages; [
|
pythonPath = with pythonPackages; [
|
||||||
|
dbus
|
||||||
pillow
|
pillow
|
||||||
pythonDBus
|
|
||||||
pygobject
|
pygobject
|
||||||
recursivePthLoader
|
recursivePthLoader
|
||||||
reportlab
|
reportlab
|
||||||
@ -144,6 +156,6 @@ stdenv.mkDerivation {
|
|||||||
then licenses.unfree
|
then licenses.unfree
|
||||||
else with licenses; [ mit bsd2 gpl2Plus ];
|
else with licenses; [ mit bsd2 gpl2Plus ];
|
||||||
platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" ];
|
platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" ];
|
||||||
maintainers = with maintainers; [ ttuegel jgeerds ];
|
maintainers = with maintainers; [ ttuegel jgeerds nckx ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user