220 lines
9.8 KiB
Diff
220 lines
9.8 KiB
Diff
diff -up system-config-printer-1.5.1/newprinter.py.python3 system-config-printer-1.5.1/newprinter.py
|
|
--- system-config-printer-1.5.1/newprinter.py.python3 2014-08-22 12:34:40.000000000 +0100
|
|
+++ system-config-printer-1.5.1/newprinter.py 2014-09-11 17:19:36.138730318 +0100
|
|
@@ -1803,7 +1803,7 @@ class NewPrinterGUI(GtkGUI):
|
|
return None
|
|
|
|
faxtype = -1
|
|
- for line in stdout.split ("\n"):
|
|
+ for line in stdout.decode ().split ("\n"):
|
|
if line.find ("fax-type") == -1:
|
|
continue
|
|
res = re.search ("(\d+)", line)
|
|
@@ -1834,7 +1834,7 @@ class NewPrinterGUI(GtkGUI):
|
|
# Problem executing command.
|
|
return None
|
|
|
|
- scan_type = stdout.strip ()
|
|
+ scan_type = stdout.decode ().strip ()
|
|
fields = scan_type.split ("=", 1)
|
|
if len (fields) < 2:
|
|
return None
|
|
@@ -1864,7 +1864,7 @@ class NewPrinterGUI(GtkGUI):
|
|
# Problem executing command.
|
|
return None
|
|
|
|
- uri = stdout.strip ()
|
|
+ uri = stdout.decode ().strip ()
|
|
return uri
|
|
|
|
def getNetworkPrinterMakeModel(self, host=None, device=None):
|
|
@@ -1905,7 +1905,7 @@ class NewPrinterGUI(GtkGUI):
|
|
pass
|
|
|
|
if stdout != None:
|
|
- line = stdout.strip ()
|
|
+ line = stdout.decode ().strip ()
|
|
words = probe_printer.wordsep (line)
|
|
n = len (words)
|
|
if n < 4:
|
|
@@ -3874,7 +3874,7 @@ class NewPrinterGUI(GtkGUI):
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.PIPE)
|
|
(stdout, stderr) = p.communicate ()
|
|
- err += stdout
|
|
+ err += stdout.decode ()
|
|
except:
|
|
# Problem executing command.
|
|
raise
|
|
diff -up system-config-printer-1.5.1/probe_printer.py.python3 system-config-printer-1.5.1/probe_printer.py
|
|
--- system-config-printer-1.5.1/probe_printer.py.python3 2014-08-22 12:20:15.000000000 +0100
|
|
+++ system-config-printer-1.5.1/probe_printer.py 2014-09-11 17:19:36.139730323 +0100
|
|
@@ -1,8 +1,8 @@
|
|
## system-config-printer
|
|
|
|
-## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
|
|
+## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014 Red Hat, Inc.
|
|
## Copyright (C) 2006 Florian Festi <ffesti@redhat.com>
|
|
-## Copyright (C) 2007, 2008, 2009 Tim Waugh <twaugh@redhat.com>
|
|
+## Copyright (C) 2007, 2008, 2009, 2014 Tim Waugh <twaugh@redhat.com>
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
## it under the terms of the GNU General Public License as published by
|
|
@@ -272,15 +272,14 @@ class PrinterFinder:
|
|
|
|
def _probe_snmp (self):
|
|
# Run the CUPS SNMP backend, pointing it at the host.
|
|
- null = open ("/dev/null", "r+")
|
|
try:
|
|
debugprint ("snmp: trying")
|
|
p = subprocess.Popen (args=["/usr/lib/cups/backend/snmp",
|
|
self.hostname],
|
|
close_fds=True,
|
|
- stdin=null,
|
|
+ stdin=subprocess.DEVNULL,
|
|
stdout=subprocess.PIPE,
|
|
- stderr=null)
|
|
+ stderr=subprocess.DEVNULL)
|
|
except OSError as e:
|
|
debugprint ("snmp: no good")
|
|
if e == errno.ENOENT:
|
|
@@ -297,7 +296,7 @@ class PrinterFinder:
|
|
debugprint ("snmp: no good")
|
|
return
|
|
|
|
- for line in stdout.decode('utf-8').split ('\n'):
|
|
+ for line in stdout.decode ().split ('\n'):
|
|
words = wordsep (line)
|
|
n = len (words)
|
|
if n == 6:
|
|
@@ -365,14 +364,13 @@ class PrinterFinder:
|
|
self._cached_attributes['device-make-and-model'])
|
|
return
|
|
|
|
- null = open ("/dev/null", "r+")
|
|
try:
|
|
debugprint ("hplip: trying")
|
|
p = subprocess.Popen (args=["hp-makeuri", "-c", self.hostname],
|
|
close_fds=True,
|
|
- stdin=null,
|
|
+ stdin=subprocess.DEVNULL,
|
|
stdout=subprocess.PIPE,
|
|
- stderr=null)
|
|
+ stderr=subprocess.DEVNULL)
|
|
except OSError as e:
|
|
if e == errno.ENOENT:
|
|
return
|
|
@@ -388,7 +386,7 @@ class PrinterFinder:
|
|
debugprint ("hplip: no good")
|
|
return
|
|
|
|
- uri = stdout.strip ()
|
|
+ uri = stdout.decode ().strip ()
|
|
debugprint ("hplip: uri is %s" % uri)
|
|
if uri.find (":") != -1:
|
|
self._new_device(uri, uri)
|
|
diff -up system-config-printer-1.5.1/system-config-printer.py.python3 system-config-printer-1.5.1/system-config-printer.py
|
|
--- system-config-printer-1.5.1/system-config-printer.py.python3 2014-08-22 12:20:15.000000000 +0100
|
|
+++ system-config-printer-1.5.1/system-config-printer.py 2014-09-11 17:19:36.140730329 +0100
|
|
@@ -736,7 +736,7 @@ class GUI(GtkGUI):
|
|
self.cups_connection_error)
|
|
self.monitor.connect ('cups-connection-recovered',
|
|
self.cups_connection_recovered)
|
|
- GObject.idle_add (self.monitor.refresh)
|
|
+ GLib.idle_add (self.monitor.refresh)
|
|
self.propertiesDlg.set_monitor (self.monitor)
|
|
|
|
if connected:
|
|
diff -up system-config-printer-1.5.1/troubleshoot/CheckSELinux.py.python3 system-config-printer-1.5.1/troubleshoot/CheckSELinux.py
|
|
--- system-config-printer-1.5.1/troubleshoot/CheckSELinux.py.python3 2014-08-22 12:20:15.000000000 +0100
|
|
+++ system-config-printer-1.5.1/troubleshoot/CheckSELinux.py 2014-09-11 17:19:40.508754380 +0100
|
|
@@ -2,7 +2,7 @@
|
|
|
|
## Printing troubleshooter
|
|
|
|
-## Copyright (C) 2010 Red Hat, Inc.
|
|
+## Copyright (C) 2010, 2014 Red Hat, Inc.
|
|
## Copyright (C) 2010 Jiri Popelka <jpopelka@redhat.com>
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
@@ -48,7 +48,6 @@ class CheckSELinux(Question):
|
|
return False
|
|
|
|
paths = ["/etc/cups/", "/usr/lib/cups/", "/usr/share/cups/"]
|
|
- null = open ("/dev/null", "r+")
|
|
parent = self.troubleshooter.get_window ()
|
|
contexts = {}
|
|
new_environ = os.environ.copy()
|
|
@@ -60,9 +59,9 @@ class CheckSELinux(Question):
|
|
args=restorecon_args,
|
|
close_fds=True,
|
|
env=new_environ,
|
|
- stdin=null,
|
|
+ stdin=subprocess.DEVNULL,
|
|
stdout=subprocess.PIPE,
|
|
- stderr=null)
|
|
+ stderr=subprocess.DEVNULL)
|
|
(restorecon_stdout, restorecon_stderr, result) = self.op.run ()
|
|
except:
|
|
# Problem executing command.
|
|
diff -up system-config-printer-1.5.1/troubleshoot/VerifyPackages.py.python3 system-config-printer-1.5.1/troubleshoot/VerifyPackages.py
|
|
--- system-config-printer-1.5.1/troubleshoot/VerifyPackages.py.python3 2014-08-22 12:20:15.000000000 +0100
|
|
+++ system-config-printer-1.5.1/troubleshoot/VerifyPackages.py 2014-09-11 17:19:40.508754380 +0100
|
|
@@ -2,7 +2,7 @@
|
|
|
|
## Printing troubleshooter
|
|
|
|
-## Copyright (C) 2010 Red Hat, Inc.
|
|
+## Copyright (C) 2010, 2014 Red Hat, Inc.
|
|
## Copyright (C) 2010 Jiri Popelka <jpopelka@redhat.com>
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
@@ -45,7 +45,6 @@ class VerifyPackages(Question):
|
|
"hpijs",
|
|
"hplip",
|
|
"system-config-printer"]
|
|
- null = open ("/dev/null", "r+")
|
|
parent = self.troubleshooter.get_window ()
|
|
|
|
new_environ = os.environ.copy()
|
|
@@ -58,9 +57,9 @@ class VerifyPackages(Question):
|
|
args=verification_args,
|
|
close_fds=True,
|
|
env=new_environ,
|
|
- stdin=null,
|
|
+ stdin=subprocess.DEVNULL,
|
|
stdout=subprocess.PIPE,
|
|
- stderr=null)
|
|
+ stderr=subprocess.DEVNULL)
|
|
(verif_stdout, verif_stderr, result) = self.op.run ()
|
|
except:
|
|
# Problem executing command.
|
|
diff -up system-config-printer-1.5.1/userdefault.py.python3 system-config-printer-1.5.1/userdefault.py
|
|
--- system-config-printer-1.5.1/userdefault.py.python3 2014-08-22 12:20:15.000000000 +0100
|
|
+++ system-config-printer-1.5.1/userdefault.py 2014-09-11 17:19:40.508754380 +0100
|
|
@@ -1,6 +1,6 @@
|
|
#!/usr/bin/python3
|
|
|
|
-## Copyright (C) 2006, 2007, 2008, 2010, 2012 Red Hat, Inc.
|
|
+## Copyright (C) 2006, 2007, 2008, 2010, 2012, 2014 Red Hat, Inc.
|
|
## Author: Tim Waugh <twaugh@redhat.com>
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
@@ -75,13 +75,13 @@ class UserDefaultPrinter:
|
|
def set (self, default):
|
|
p = subprocess.Popen ([ "lpoptions", "-d", default ],
|
|
close_fds=True,
|
|
- stdin=open ("/dev/null"),
|
|
- stdout=open ("/dev/null", "w"),
|
|
+ stdin=subprocess.DEVNULL,
|
|
+ stdout=subprocess.DEVNULL,
|
|
stderr=subprocess.PIPE)
|
|
(stdout, stderr) = p.communicate ()
|
|
exitcode = p.wait ()
|
|
if exitcode != 0:
|
|
- raise RuntimeError (exitcode, stderr.strip ())
|
|
+ raise RuntimeError (exitcode, stderr.decode ().strip ())
|
|
return
|
|
|
|
def __repr__ (self):
|