This commit is contained in:
Tim Waugh 2014-10-10 17:05:14 +01:00
parent cbf665aad2
commit 5a973a6243
8 changed files with 8 additions and 265 deletions

1
.gitignore vendored
View File

@ -250,3 +250,4 @@ pycups-1.9.51.tar.bz2
/system-config-printer-1.4.5.tar.xz
/system-config-printer-1.5.0.tar.xz
/system-config-printer-1.5.1.tar.xz
/system-config-printer-1.5.2.tar.xz

View File

@ -1 +1 @@
64057f7064d2e7383ccce593aa7db8d3 system-config-printer-1.5.1.tar.xz
ea4a217dd1db3fbf43b1cb461185df72 system-config-printer-1.5.2.tar.xz

Binary file not shown.

View File

@ -1,20 +0,0 @@
diff -up system-config-printer-1.5.1/scp-dbus-service.py.lock system-config-printer-1.5.1/scp-dbus-service.py
--- system-config-printer-1.5.1/scp-dbus-service.py.lock 2014-08-22 12:20:15.000000000 +0100
+++ system-config-printer-1.5.1/scp-dbus-service.py 2014-09-06 13:23:34.292543622 +0100
@@ -2,7 +2,7 @@
## system-config-printer
-## Copyright (C) 2010, 2011, 2012, 2013 Red Hat, Inc.
+## Copyright (C) 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
@@ -572,5 +572,7 @@ if __name__ == '__main__':
debugprint ("Service running...")
g_killtimer = KillTimer (killfunc=Gtk.main_quit)
cp = ConfigPrinting ()
+ Gdk.threads_enter ()
Gtk.main ()
+ Gdk.threads_leave ()
cp.destroy ()

View File

@ -1,11 +0,0 @@
diff -up system-config-printer-1.4.2/print-applet.desktop.in.no-applet-in-gnome system-config-printer-1.4.2/print-applet.desktop.in
--- system-config-printer-1.4.2/print-applet.desktop.in.no-applet-in-gnome 2013-05-31 17:35:03.000000000 +0100
+++ system-config-printer-1.4.2/print-applet.desktop.in 2013-08-20 11:37:28.663703579 +0100
@@ -5,6 +5,6 @@ Exec=system-config-printer-applet
Terminal=false
Type=Application
Icon=printer
-NotShowIn=KDE;
+NotShowIn=GNOME;KDE;
StartupNotify=false
X-GNOME-Autostart-Delay=30

View File

@ -1,219 +0,0 @@
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):

View File

@ -6,15 +6,12 @@
Summary: A printer administration tool
Name: system-config-printer
Version: 1.5.1
Release: 3%{?dist}
Version: 1.5.2
Release: 1%{?dist}
License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base
Source0: http://cyberelk.net/tim/data/system-config-printer/1.4/%{name}-%{version}.tar.xz
Patch1: system-config-printer-no-applet-in-gnome.patch
Patch2: system-config-printer-lock.patch
Patch3: system-config-printer-python3.patch
BuildRequires: cups-devel >= 1.2
BuildRequires: desktop-file-utils >= 0.2.92
@ -83,15 +80,6 @@ printers.
%prep
%setup -q
# Don't start the applet in GNOME.
%patch1 -p1 -b .no-applet-in-gnome
# Take the gdk lock before entering gtk_main() (bug #1052203 comment #24).
%patch2 -p1 -b .lock
# Python3 fixes from upstream.
%patch3 -p1 -b .python3
%build
%configure --with-udev-rules
make %{?_smp_mflags}
@ -135,6 +123,7 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
%{_datadir}/%{name}/newprinter.py*
%{_datadir}/%{name}/options.py*
%{_datadir}/%{name}/optionwidgets.py*
%{_datadir}/%{name}/OpenPrintingRequest.py*
%{_datadir}/%{name}/PhysicalDevice.py*
%{_datadir}/%{name}/ppdcache.py*
%{_datadir}/%{name}/ppdippstr.py*
@ -191,6 +180,9 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
exit 0
%changelog
* Fri Oct 10 2014 Tim Waugh <twaugh@redhat.com> - 1.5.2-1
- 1.5.2.
* Thu Sep 11 2014 Tim Waugh <twaugh@redhat.com> - 1.5.1-3
- Python3 fixes from upstream.