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

986012
diff -up hplip-3.15.2/fax/filters/pstotiff.pstotiff-is-rubbish hplip-3.15.2/fax/filters/pstotiff
986012
--- hplip-3.15.2/fax/filters/pstotiff.pstotiff-is-rubbish	2015-02-04 09:40:43.169147058 +0100
986012
+++ hplip-3.15.2/fax/filters/pstotiff	2015-02-04 09:47:20.786983832 +0100
986012
@@ -1,45 +1,16 @@
986012
-#!/usr/bin/env python
986012
-
986012
-import os
986012
-import os.path
986012
-import time 
986012
-import sys
986012
-import tempfile
986012
-
986012
-PY3 = sys.version_info[0] == 3
986012
-
986012
-READ_SIZE = 8192
986012
-
986012
-total_bytes_read = 0
986012
-temp_in_file = "-"
986012
-
986012
-if (len(sys.argv) > 6):
986012
-   temp_in_file = sys.argv[6] 
986012
-
986012
-temp_out_handle, temp_out_fname = tempfile.mkstemp()
986012
-
986012
-font = "-I/usr/share/cups/fonts"
986012
-device = "-sDEVICE=tiffg4 -dMaxStripSize=0 -r204x196 -dNOPAUSE -dBATCH -dSAFER -dPARANOIDSAFER -dSHORTERRORS -dWRITESYSTEMDICT -dGHOSTSCRIPT -sstdout=%stderr -sOutputFile=" + temp_out_fname + " " + temp_in_file
986012
-
986012
-gs_command = "/usr/bin/gs" + " " + font + " " + device
986012
-
986012
-exit_code = os.system(gs_command)
986012
-
986012
-file_len = os.stat(temp_out_fname).st_size
986012
-if (file_len < READ_SIZE):
986012
-    READ_SIZE = file_len
986012
-
986012
-os.close(temp_out_handle)
986012
-
986012
-out_handle = open(temp_out_fname, mode='rb')
986012
-while (total_bytes_read < file_len):
986012
-      data = out_handle.read(READ_SIZE)
986012
-      if PY3:
986012
-          sys.stdout.buffer.write(data)
986012
-      else:
986012
-          sys.stdout.write(data)
986012
-      total_bytes_read += READ_SIZE
986012
-out_handle.close()
986012
-
986012
-os.remove(temp_out_fname)
986012
-sys.exit(0)
986012
+#!/bin/sh
986012
+if [ $# -lt 6 ]; then
986012
+  IN=-_
986012
+else
986012
+  IN="$6"
986012
+fi
986012
+
986012
+TMPFILE=`mktemp /tmp/pstotiff.XXXXXX` || exit 1
986012
+gs -I/usr/share/cups/fonts -sDEVICE=tiffg4 -dMaxStripSize=0 -r204x196 \
986012
+    -dNOPAUSE -dBATCH -dSAFER -dPARANOIDSAFER \
986012
+   -dSHORTERRORS -dWRITESYSTEMDICT -dGHOSTSCRIPT \
986012
+   -sstdout=%stderr -sOutputFile="$TMPFILE" "$IN"
986012
+RET=$?
986012
+cat "$TMPFILE"
986012
+rm -f "$TMPFILE"
986012
+exit $RET