More Python 3 fixes for scripts (bug #1134092).
This commit is contained in:
parent
71c633e3d9
commit
e67195d0fc
@ -111,6 +111,9 @@ def get_driver_version():
|
|||||||
except OSError:
|
except OSError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if stdout != None:
|
||||||
|
stdout = stdout.decode ()
|
||||||
|
|
||||||
return stdout
|
return stdout
|
||||||
|
|
||||||
stdout = run_with_arg ("org.gutenprint.extensions")
|
stdout = run_with_arg ("org.gutenprint.extensions")
|
||||||
@ -268,7 +271,7 @@ def update_ppd (ppd_source_filename):
|
|||||||
ppd_dest_filename = "%s/%s" % (ppd_out_dir,
|
ppd_dest_filename = "%s/%s" % (ppd_out_dir,
|
||||||
os.path.basename (ppd_dest_filename))
|
os.path.basename (ppd_dest_filename))
|
||||||
|
|
||||||
orig = io.FileIO (ppd_source_filename)
|
orig = open (ppd_source_filename, encoding="utf-8")
|
||||||
orig_metadata = os.fstat (orig.fileno ())
|
orig_metadata = os.fstat (orig.fileno ())
|
||||||
if debug & 1:
|
if debug & 1:
|
||||||
print ("Source Filename: %s" % ppd_source_filename)
|
print ("Source Filename: %s" % ppd_source_filename)
|
||||||
@ -596,7 +599,7 @@ def update_ppd (ppd_source_filename):
|
|||||||
# Write new PPD...
|
# Write new PPD...
|
||||||
tmpnew = "%s.new" % ppd_dest_filename
|
tmpnew = "%s.new" % ppd_dest_filename
|
||||||
try:
|
try:
|
||||||
newppd = io.FileIO (tmpnew, "w")
|
newppd = open (tmpnew, "w")
|
||||||
except IOError as err:
|
except IOError as err:
|
||||||
(e, s) = err.args
|
(e, s) = err.args
|
||||||
print ("Can't create %s: %s" % (tmpnew, s))
|
print ("Can't create %s: %s" % (tmpnew, s))
|
||||||
@ -774,10 +777,11 @@ def get_ppd_fh (ppd_source_filename, filename, driver, locale, region):
|
|||||||
stderr=subprocess.DEVNULL)
|
stderr=subprocess.DEVNULL)
|
||||||
server_multicat_initialized = mc_proc
|
server_multicat_initialized = mc_proc
|
||||||
|
|
||||||
print ("%s" % url, file=server_multicat_initialized.stdin)
|
mc_in = io.TextIOWrapper (server_multicat_initialized.stdin)
|
||||||
server_multicat_initialized.stdin.flush ()
|
print ("%s" % url, file=mc_in)
|
||||||
|
mc_in.flush ()
|
||||||
return (new_ppd_filename,
|
return (new_ppd_filename,
|
||||||
server_multicat_initialized.stdout)
|
io.TextIOWrapper (server_multicat_initialized.stdout))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -787,7 +791,7 @@ def get_ppd_fh (ppd_source_filename, filename, driver, locale, region):
|
|||||||
stdin=subprocess.DEVNULL,
|
stdin=subprocess.DEVNULL,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.DEVNULL)
|
stderr=subprocess.DEVNULL)
|
||||||
return (new_ppd_filename, proc.stdout)
|
return (new_ppd_filename, io.TextIOWrapper (proc.stdout))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -821,9 +825,9 @@ def get_ppd_fh (ppd_source_filename, filename, driver, locale, region):
|
|||||||
print ("can't open for decompression: %s" % s)
|
print ("can't open for decompression: %s" % s)
|
||||||
sys.exit (1)
|
sys.exit (1)
|
||||||
|
|
||||||
return (new_ppd_filename, proc.stdout)
|
return (new_ppd_filename, io.TextIOWrapper (proc.stdout))
|
||||||
else:
|
else:
|
||||||
return (new_ppd_filename, io.FileIO (new_ppd_filename))
|
return (new_ppd_filename, open (new_ppd_filename))
|
||||||
|
|
||||||
def find_ppd (gutenprintfilename, drivername, lang, region):
|
def find_ppd (gutenprintfilename, drivername, lang, region):
|
||||||
global file_version
|
global file_version
|
||||||
@ -909,7 +913,7 @@ def find_ppd (gutenprintfilename, drivername, lang, region):
|
|||||||
new_file_version = ""
|
new_file_version = ""
|
||||||
else:
|
else:
|
||||||
(stdin, stderr) = p.communicate ()
|
(stdin, stderr) = p.communicate ()
|
||||||
new_file_version = stdin.rstrip ()
|
new_file_version = stdin.decode ().rstrip ()
|
||||||
|
|
||||||
if new_file_version != "":
|
if new_file_version != "":
|
||||||
if debug & 8:
|
if debug & 8:
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import glob
|
import glob
|
||||||
import io
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -46,7 +45,8 @@ def generate_ppd (ppdfile, printer, driver):
|
|||||||
(ppd, stderr) = p.communicate ()
|
(ppd, stderr) = p.communicate ()
|
||||||
fname = ppdfile + ".tmp"
|
fname = ppdfile + ".tmp"
|
||||||
try:
|
try:
|
||||||
io.FileIO (fname, "w").write (ppd)
|
with open (fname, "w") as f:
|
||||||
|
f.write (ppd)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print (e)
|
print (e)
|
||||||
raise
|
raise
|
||||||
@ -129,8 +129,8 @@ def update_ppdfile (ppdfile):
|
|||||||
if ps:
|
if ps:
|
||||||
update_options ([ps], genppd, ppd)
|
update_options ([ps], genppd, ppd)
|
||||||
|
|
||||||
f = io.FileIO (ppdfile, "w")
|
with open (ppdfile, "w") as f:
|
||||||
genppd.writeFd (f.fileno ())
|
genppd.writeFd (f.fileno ())
|
||||||
print ("Updated PPD file %s" % ppdfile)
|
print ("Updated PPD file %s" % ppdfile)
|
||||||
|
|
||||||
for ppdfile in glob.glob ("/etc/cups/ppd/*.ppd"):
|
for ppdfile in glob.glob ("/etc/cups/ppd/*.ppd"):
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Name: gutenprint
|
Name: gutenprint
|
||||||
Summary: Printer Drivers Package
|
Summary: Printer Drivers Package
|
||||||
Version: 5.2.10
|
Version: 5.2.10
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
URL: http://gimp-print.sourceforge.net/
|
URL: http://gimp-print.sourceforge.net/
|
||||||
Source0: http://downloads.sourceforge.net/gimp-print/%{name}-%{version}.tar.bz2
|
Source0: http://downloads.sourceforge.net/gimp-print/%{name}-%{version}.tar.bz2
|
||||||
# Post-install script to update foomatic PPDs.
|
# Post-install script to update foomatic PPDs.
|
||||||
@ -281,6 +281,9 @@ fi
|
|||||||
/bin/rm -f /var/cache/foomatic/*
|
/bin/rm -f /var/cache/foomatic/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Aug 29 2014 Tim Waugh <twaugh@redhat.com> - 5.2.10-8
|
||||||
|
- More Python 3 fixes for scripts (bug #1134092).
|
||||||
|
|
||||||
* Fri Aug 22 2014 Tim Waugh <twaugh@redhat.com> - 5.2.10-7
|
* Fri Aug 22 2014 Tim Waugh <twaugh@redhat.com> - 5.2.10-7
|
||||||
- Python 3 fixes for scripts (bug #1132924).
|
- Python 3 fixes for scripts (bug #1132924).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user