hplip: patch shebangs in $out/share

A full wrap isn't needed as these scripts are only run from within
hplip's own environment, and unwanted because they are imported
as Python modules.

Also fix a reference to /etc in $out/etc/hp/hplip.conf, though I've no
idea whether it is actually used.
This commit is contained in:
Tobias Geerinckx-Rice 2015-07-22 23:17:08 +02:00
parent 603b146979
commit aebb3ec0f4

View File

@ -139,9 +139,9 @@ stdenv.mkDerivation {
'')); ''));
fixupPhase = '' fixupPhase = ''
# Wrap the user-facing Python scripts in /bin without turning the ones # Wrap the user-facing Python scripts in $out/bin without turning the
# in /share into shell scripts (they need to be importable). # ones in $out /share into shell scripts (they need to be importable).
# Complicated by the fact that /bin contains just symlinks to /share. # Note that $out/bin contains only symlinks to $out/share.
for bin in $out/bin/*; do for bin in $out/bin/*; do
py=`readlink -m $bin` py=`readlink -m $bin`
rm $bin rm $bin
@ -153,7 +153,18 @@ stdenv.mkDerivation {
# Remove originals. Knows a little too much about wrapPythonProgramsIn. # Remove originals. Knows a little too much about wrapPythonProgramsIn.
rm -f $out/bin/.*-wrapped rm -f $out/bin/.*-wrapped
# Merely patching shebangs in $out/share does not cause trouble.
for i in $out/share/hplip{,/*}/*.py; do
substituteInPlace $i \
--replace /usr/bin/python \
${pythonPackages.python}/bin/${pythonPackages.python.executable} \
--replace "/usr/bin/env python" \
${pythonPackages.python}/bin/${pythonPackages.python.executable}
done
wrapPythonProgramsIn $out/lib "$out $pythonPath" wrapPythonProgramsIn $out/lib "$out $pythonPath"
substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {