hplip: fix (Python) tools again

Something changed in the generic fixupPhase magic exposing a bug
in the previous fix (wrapPythonPrograms where I should have used
wrapPythonProgramsIn).

Also move buildInputs and friends to a more conventional spot.
This commit is contained in:
Tobias Geerinckx-Rice 2015-07-22 20:21:32 +02:00
parent 3e79e3a264
commit 72f6a797fa

View File

@ -39,6 +39,28 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit name src; inherit name src;
buildInputs = [
libjpeg
cups
libusb1
pythonPackages.python
pythonPackages.wrapPython
saneBackends
dbus
net_snmp
] ++ stdenv.lib.optional qtSupport qt4;
nativeBuildInputs = [
pkgconfig
];
pythonPath = with pythonPackages; [
dbus
pillow
pygobject
recursivePthLoader
reportlab
] ++ stdenv.lib.optional qtSupport pyqt4;
prePatch = '' prePatch = ''
# HPLIP hardcodes absolute paths everywhere. Nuke from orbit. # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
find . -type f -exec sed -i \ find . -type f -exec sed -i \
@ -73,24 +95,7 @@ stdenv.mkDerivation {
''; '';
postInstall = postInstall =
'' (stdenv.lib.optionalString withPlugin
# 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
wrapPythonPrograms $out/lib "$out $pythonPath"
''
+ (stdenv.lib.optionalString withPlugin
(let hplip_arch = (let hplip_arch =
if stdenv.system == "i686-linux" then "x86_32" if stdenv.system == "i686-linux" then "x86_32"
else if stdenv.system == "x86_64-linux" then "x86_64" else if stdenv.system == "x86_64-linux" then "x86_64"
@ -131,27 +136,23 @@ stdenv.mkDerivation {
rm $out/etc/udev/rules.d/56-hpmud.rules rm $out/etc/udev/rules.d/56-hpmud.rules
'')); ''));
buildInputs = [ fixupPhase = ''
libjpeg # Wrap the user-facing Python scripts in /bin without turning the ones
cups # in /share into shell scripts (they need to be importable).
libusb1 # Complicated by the fact that /bin contains just symlinks to /share.
pythonPackages.python for bin in $out/bin/*; do
pythonPackages.wrapPython py=`readlink -m $bin`
saneBackends rm $bin
dbus cp $py $bin
net_snmp wrapPythonProgramsIn $bin "$out $pythonPath"
] ++ stdenv.lib.optional qtSupport qt4; sed -i "s@$(dirname $bin)/[^ ]*@$py@g" $bin
nativeBuildInputs = [ done
pkgconfig
];
pythonPath = with pythonPackages; [ # Remove originals. Knows a little too much about wrapPythonProgramsIn.
dbus rm -f $out/bin/.*-wrapped
pillow
pygobject wrapPythonProgramsIn $out/lib "$out $pythonPath"
recursivePthLoader '';
reportlab
] ++ stdenv.lib.optional qtSupport pyqt4;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Print, scan and fax HP drivers for Linux"; description = "Print, scan and fax HP drivers for Linux";