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

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