Blame SOURCES/hplip-pstotiff-is-rubbish.patch

2d2a51
diff -up hplip-3.11.7/fax/filters/pstotiff.pstotiff-is-rubbish hplip-3.11.7/fax/filters/pstotiff
2d2a51
--- hplip-3.11.7/fax/filters/pstotiff.pstotiff-is-rubbish	2011-07-24 21:06:43.000000000 +0200
2d2a51
+++ hplip-3.11.7/fax/filters/pstotiff	2011-07-25 13:42:27.776988201 +0200
2d2a51
@@ -1,40 +1,16 @@
2d2a51
-#!/usr/bin/env python
2d2a51
-
2d2a51
-import os
2d2a51
-import os.path
2d2a51
-import time 
2d2a51
-import sys
2d2a51
-import tempfile
2d2a51
-
2d2a51
-READ_SIZE = 8192
2d2a51
-
2d2a51
-total_bytes_read = 0
2d2a51
-temp_in_file = "-"
2d2a51
-
2d2a51
-if (len(sys.argv) > 6):
2d2a51
-   temp_in_file = sys.argv[6] 
2d2a51
-
2d2a51
-temp_out_handle, temp_out_fname = tempfile.mkstemp()
2d2a51
-
2d2a51
-font = "-I/usr/share/cups/fonts"
2d2a51
-device = "-sDEVICE=tiffg4 -dMaxStripSize=0 -r204x196 -dNOPAUSE -dBATCH -dSAFER -dPARANOIDSAFER -dSHORTERRORS -dWRITESYSTEMDICT -dGHOSTSCRIPT -sstdout=%stderr -sOutputFile=" + temp_out_fname + " " + temp_in_file
2d2a51
-
2d2a51
-gs_command = "/usr/bin/gs" + " " + font + " " + device
2d2a51
-
2d2a51
-exit_code = os.system(gs_command)
2d2a51
-
2d2a51
-file_len = os.stat(temp_out_fname).st_size
2d2a51
-if (file_len < READ_SIZE):
2d2a51
-    READ_SIZE = file_len
2d2a51
-
2d2a51
-os.close(temp_out_handle)
2d2a51
-
2d2a51
-out_handle = open(temp_out_fname, mode='rb')
2d2a51
-while (total_bytes_read < file_len):
2d2a51
-      data = out_handle.read(READ_SIZE)
2d2a51
-      sys.stdout.write(data)
2d2a51
-      total_bytes_read += READ_SIZE
2d2a51
-out_handle.close()
2d2a51
-
2d2a51
-os.remove(temp_out_fname)
2d2a51
-sys.exit(0)
2d2a51
+#!/bin/sh
2d2a51
+if [ $# -lt 6 ]; then
2d2a51
+  IN=-_
2d2a51
+else
2d2a51
+  IN="$6"
2d2a51
+fi
2d2a51
+
2d2a51
+TMPFILE=`mktemp /tmp/pstotiff.XXXXXX` || exit 1
2d2a51
+gs -I/usr/share/cups/fonts -sDEVICE=tiffg4 -dMaxStripSize=0 -r204x196 \
2d2a51
+    -dNOPAUSE -dBATCH -dSAFER -dPARANOIDSAFER \
2d2a51
+   -dSHORTERRORS -dWRITESYSTEMDICT -dGHOSTSCRIPT \
2d2a51
+   -sstdout=%stderr -sOutputFile="$TMPFILE" "$IN"
2d2a51
+RET=$?
2d2a51
+cat "$TMPFILE"
2d2a51
+rm -f "$TMPFILE"
2d2a51
+exit $RET