rpms/system-config-printer/F-11 system-config-printer-polkit-1.patch, NONE, 1.1 system-config-printer-get-devices.patch, 1.2, 1.3 system-config-printer.spec, 1.283, 1.284
Tim Waugh
twaugh at fedoraproject.org
Mon Sep 14 14:13:20 UTC 2009
Author: twaugh
Update of /cvs/pkgs/rpms/system-config-printer/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27279
Modified Files:
system-config-printer-get-devices.patch
system-config-printer.spec
Added Files:
system-config-printer-polkit-1.patch
Log Message:
* Mon Sep 14 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-9
- Fixed traceback when fetching devices (bug #522139).
system-config-printer-polkit-1.patch:
Makefile.am | 1 +
authconn.py | 10 +++++-----
config.py.in | 1 +
configure.in | 11 +++++++++++
cupspk.py | 9 ++++++++-
system-config-printer.py | 35 ++++++++++++++++++++++++-----------
6 files changed, 50 insertions(+), 17 deletions(-)
--- NEW FILE system-config-printer-polkit-1.patch ---
diff -up system-config-printer-1.1.12/authconn.py.polkit-1 system-config-printer-1.1.12/authconn.py
--- system-config-printer-1.1.12/authconn.py.polkit-1 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/authconn.py 2009-09-14 14:54:09.999997175 +0100
@@ -24,6 +24,7 @@ import gobject
import gtk
import os
from errordialogs import *
+import config
from debug import *
_ = lambda x: x
@@ -156,8 +157,11 @@ class Connection:
cups.setUser (self._use_user)
self._use_pk = ((self._server[0] == '/' or self._server == 'localhost')
- and not self._lock
and os.getuid () != 0)
+
+ if not config.WITH_POLKIT_1 and self._lock:
+ self._use_pk = False
+
if self._use_pk:
create_object = cupspk.Connection
else:
@@ -208,10 +212,6 @@ class Connection:
break
except cups.IPPError, (e, m):
if self._use_pk and m == 'pkcancel':
- title = _('Unauthorized request (%s)') % fname
- text = _("You are not authorized to carry out the "
- "requested action.")
- show_error_dialog (title, text, None)
raise cups.IPPError (0, _("Operation canceled"))
if not self._cancel and (e == cups.IPP_NOT_AUTHORIZED or
e == cups.IPP_FORBIDDEN):
diff -up system-config-printer-1.1.12/config.py.in.polkit-1 system-config-printer-1.1.12/config.py.in
--- system-config-printer-1.1.12/config.py.in.polkit-1 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/config.py.in 2009-09-14 14:54:10.003997327 +0100
@@ -24,3 +24,4 @@ localedir="@localedir@"
pkgdatadir="@datadir@/@PACKAGE@"
VERSION="@VERSION@"
PACKAGE="@PACKAGE@"
+WITH_POLKIT_1=@WITH_POLKIT_1@
diff -up system-config-printer-1.1.12/configure.in.polkit-1 system-config-printer-1.1.12/configure.in
--- system-config-printer-1.1.12/configure.in.polkit-1 2009-08-25 17:01:27.000000000 +0100
+++ system-config-printer-1.1.12/configure.in 2009-09-14 14:54:10.004997135 +0100
@@ -43,6 +43,17 @@ if test x$with_udev_rules != xno; then
AM_PROG_CC_C_O
fi
+AC_ARG_WITH(polkit-1,
+ [AC_HELP_STRING([--with-polkit-1],
+ [Enable support for polkit-1 @<:@default=no@:>@])],
+ [],
+ [with_polkit_1=no])
+WITH_POLKIT_1=False
+if test x$with_polkit_1 != xno; then
+ WITH_POLKIT_1=True
+fi
+AC_SUBST(WITH_POLKIT_1)
+
ALL_LINGUAS="ar as bg bn_IN bn bs ca cs cy da de el en_GB es et fa fi fr gu he hi hr hu hy id is it ja ka kn ko lo lv mai mk ml mr ms my nb nl nn or pa pl pt_BR pt ro ru si sk sl sr at latin sr sv ta te th tr uk vi zh_CN zh_TW"
AC_CONFIG_FILES([
Makefile
diff -up system-config-printer-1.1.12/cupspk.py.polkit-1 system-config-printer-1.1.12/cupspk.py
--- system-config-printer-1.1.12/cupspk.py.polkit-1 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/cupspk.py 2009-09-14 14:54:10.015998069 +0100
@@ -34,6 +34,7 @@ import tempfile
import cups
import dbus
import gtk
+import config
from debug import debugprint
from dbus.mainloop.glib import DBusGMainLoop
@@ -221,8 +222,14 @@ class Connection:
return retval
break
except dbus.exceptions.DBusException, e:
- if not self._handle_exception_with_auth(e):
+ if config.WITH_POLKIT_1:
+ if e.get_dbus_name() == CUPS_PK_NEED_AUTH:
+ raise cups.IPPError(cups.IPP_NOT_AUTHORIZED, 'pkcancel')
+
break
+ else:
+ if not self._handle_exception_with_auth(e):
+ break
# The PolicyKit call did not work (either a PK-error and we got a dbus
# exception that wasn't handled, or an error in the mechanism itself)
diff -up system-config-printer-1.1.12/Makefile.am.polkit-1 system-config-printer-1.1.12/Makefile.am
--- system-config-printer-1.1.12/Makefile.am.polkit-1 2009-08-25 17:01:27.000000000 +0100
+++ system-config-printer-1.1.12/Makefile.am 2009-09-14 14:54:10.018997090 +0100
@@ -39,6 +39,7 @@ config.py: config.py.in Makefile
-e "s|\@localedir\@|$(localedir)|" \
-e "s|\@VERSION\@|$(VERSION)|" \
-e "s|\@PACKAGE\@|$(PACKAGE)|" \
+ -e "s|\@WITH_POLKIT_1\@|$(WITH_POLKIT_1)|" \
$< > $@
# Use distutils to build the module.
diff -up system-config-printer-1.1.12/system-config-printer.py.polkit-1 system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.polkit-1 2009-09-14 14:53:42.800872681 +0100
+++ system-config-printer-1.1.12/system-config-printer.py 2009-09-14 14:54:10.046997443 +0100
@@ -4620,19 +4620,32 @@ class NewPrinterGUI(GtkGUI):
self.WaitWindow.set_transient_for (parent)
self.WaitWindow.show_now ()
self.busy (self.WaitWindow)
- while gtk.events_pending ():
- gtk.main_iteration ()
- debugprint ("Fetching devices")
- self.mainapp.cups._begin_operation (_("fetching device list"))
- try:
- devices = cupshelpers.getDevices(self.mainapp.cups)
- except:
- self.mainapp.cups._end_operation ()
- self.WaitWindow.hide ()
- raise
+ if self.mainapp.cups._use_pk and config.WITH_POLKIT_1:
+ def get_devices():
+ c = authconn.Connection (host=self.mainapp.connect_server,
+ parent=parent, lock=True)
+ c._begin_operation (_("fetching device list"))
+ ret = cupshelpers.getDevices (c)
+ c._end_operation ()
+ return ret
+
+ op = TimedOperation (get_devices)
+ try:
+ devices = op.run ()
+ except (OperationCanceled, RuntimeError, cups.IPPError):
+ self.WaitWindow.hide ()
+ raise
+ else:
+ self.mainapp.cups._begin_operation (_("fetching device list"))
+ try:
+ devices = cupshelpers.getDevices (self.mainapp.cups)
+ self.mainapp.cups._end_operation ()
+ except cups.IPPError:
+ self.mainapp.cups._end_operation ()
+ self.WaitWindow.hide ()
+ raise
- self.mainapp.cups._end_operation ()
self.WaitWindow.hide ()
debugprint ("Got devices")
return devices
system-config-printer-get-devices.patch:
cupshelpers/cupshelpers.py | 4
cupspk.py | 18 +++
gtkspinner.py | 2
system-config-printer.py | 220 ++++++++++++++++++++++++++++-----------------
timedops.py | 38 ++++++-
5 files changed, 189 insertions(+), 93 deletions(-)
Index: system-config-printer-get-devices.patch
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/F-11/system-config-printer-get-devices.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- system-config-printer-get-devices.patch 4 Sep 2009 10:12:44 -0000 1.2
+++ system-config-printer-get-devices.patch 14 Sep 2009 14:13:19 -0000 1.3
@@ -1,6 +1,6 @@
diff -up system-config-printer-1.1.12/cupshelpers/cupshelpers.py.get-devices system-config-printer-1.1.12/cupshelpers/cupshelpers.py
--- system-config-printer-1.1.12/cupshelpers/cupshelpers.py.get-devices 2009-08-25 15:01:40.000000000 +0100
-+++ system-config-printer-1.1.12/cupshelpers/cupshelpers.py 2009-09-04 10:41:43.122388349 +0100
++++ system-config-printer-1.1.12/cupshelpers/cupshelpers.py 2009-09-04 10:40:45.092512574 +0100
@@ -541,7 +541,7 @@ class Device:
return result
@@ -20,9 +20,9 @@ diff -up system-config-printer-1.1.12/cu
device = Device(uri, **data)
devices[uri] = device
diff -up system-config-printer-1.1.12/cupspk.py.get-devices system-config-printer-1.1.12/cupspk.py
---- system-config-printer-1.1.12/cupspk.py.get-devices 2009-08-25 15:01:40.000000000 +0100
-+++ system-config-printer-1.1.12/cupspk.py 2009-09-04 10:41:43.125389269 +0100
-@@ -304,12 +304,13 @@ class Connection:
+--- system-config-printer-1.1.12/cupspk.py.get-devices 2009-09-04 10:40:45.010390541 +0100
++++ system-config-printer-1.1.12/cupspk.py 2009-09-04 10:40:45.095512451 +0100
+@@ -311,12 +311,13 @@ class Connection:
def getDevices(self, *args, **kwds):
use_pycups = False
@@ -39,7 +39,7 @@ diff -up system-config-printer-1.1.12/cu
else:
if kwds.has_key('timeout'):
timeout = kwds['timeout']
-@@ -320,6 +321,17 @@ class Connection:
+@@ -327,6 +328,17 @@ class Connection:
if kwds.has_key('exclude_schemes'):
exclude_schemes = kwds['exclude_schemes']
@@ -59,7 +59,7 @@ diff -up system-config-printer-1.1.12/cu
result = self._call_with_pk_and_fallback(use_pycups,
diff -up system-config-printer-1.1.12/gtkspinner.py.get-devices system-config-printer-1.1.12/gtkspinner.py
--- system-config-printer-1.1.12/gtkspinner.py.get-devices 2009-08-25 15:01:40.000000000 +0100
-+++ system-config-printer-1.1.12/gtkspinner.py 2009-09-04 10:41:43.126388753 +0100
++++ system-config-printer-1.1.12/gtkspinner.py 2009-09-04 10:40:45.096512525 +0100
@@ -65,7 +65,7 @@ class Spinner:
def _next_frame (self):
n = self._current_frame + 1
@@ -70,8 +70,8 @@ diff -up system-config-printer-1.1.12/gt
self._set_frame (n)
return True
diff -up system-config-printer-1.1.12/system-config-printer.py.get-devices system-config-printer-1.1.12/system-config-printer.py
---- system-config-printer-1.1.12/system-config-printer.py.get-devices 2009-09-04 10:41:43.112387975 +0100
-+++ system-config-printer-1.1.12/system-config-printer.py 2009-09-04 10:41:50.189513008 +0100
+--- system-config-printer-1.1.12/system-config-printer.py.get-devices 2009-09-04 10:40:45.074388881 +0100
++++ system-config-printer-1.1.12/system-config-printer.py 2009-09-04 10:40:54.528387635 +0100
@@ -3681,6 +3681,7 @@ class NewPrinterGUI(GtkGUI):
self.ntbkNPDownloadableDriverProperties.set_show_tabs(False)
@@ -111,7 +111,7 @@ diff -up system-config-printer-1.1.12/sy
self.NewPrinterWindow.hide()
if self.openprinting_query_handle != None:
self.openprinting.cancelOperation (self.openprinting_query_handle)
-@@ -4611,32 +4629,48 @@ class NewPrinterGUI(GtkGUI):
+@@ -4611,45 +4629,48 @@ class NewPrinterGUI(GtkGUI):
self.btnNPForward.set_sensitive(
self.mainapp.checkNPName(new_text))
@@ -126,24 +126,40 @@ diff -up system-config-printer-1.1.12/sy
- self.WaitWindow.set_transient_for (parent)
- self.WaitWindow.show_now ()
- self.busy (self.WaitWindow)
-- while gtk.events_pending ():
-- gtk.main_iteration ()
-- debugprint ("Fetching devices")
-- self.mainapp.cups._begin_operation (_("fetching device list"))
+- if self.mainapp.cups._use_pk and config.WITH_POLKIT_1:
+- def get_devices():
+- c = authconn.Connection (host=self.mainapp.connect_server,
+- parent=parent, lock=True)
+- c._begin_operation (_("fetching device list"))
+- ret = cupshelpers.getDevices (c)
+- c._end_operation ()
+- return ret
+ have_polkit_1 = self.mainapp.cups._use_pk and config.WITH_POLKIT_1
+ if not have_polkit_1:
+ if network:
+ return {}
-+
+
+- op = TimedOperation (get_devices)
+- try:
+- devices = op.run ()
+- except (OperationCanceled, RuntimeError, cups.IPPError):
+- self.WaitWindow.hide ()
+- raise
+- else:
+- self.mainapp.cups._begin_operation (_("fetching device list"))
+- try:
+- devices = cupshelpers.getDevices (self.mainapp.cups)
+- self.mainapp.cups._end_operation ()
+- except cups.IPPError:
+- self.mainapp.cups._end_operation ()
+- self.WaitWindow.hide ()
+- raise
+ network = True
-+
+
+- self.WaitWindow.hide ()
+ network_schemes = ["dnssd", "snmp"]
- try:
-- devices = cupshelpers.getDevices(self.mainapp.cups)
-- except:
-- self.mainapp.cups._end_operation ()
-- self.WaitWindow.hide ()
++ try:
+ c = authconn.Connection (host=self.mainapp.connect_server,
+ parent=parent, lock=True)
+ debugprint ("in get_devices: connected")
@@ -169,10 +185,8 @@ diff -up system-config-printer-1.1.12/sy
+ raise
+ except cups.IPPError:
+ c._end_operation ()
- raise
-
-- self.mainapp.cups._end_operation ()
-- self.WaitWindow.hide ()
++ raise
++
+ c._end_operation ()
debugprint ("Got devices")
- return devices
@@ -180,7 +194,7 @@ diff -up system-config-printer-1.1.12/sy
def install_hplip_plugin(self, uri):
"""
-@@ -4949,23 +4983,66 @@ class NewPrinterGUI(GtkGUI):
+@@ -4962,23 +4983,66 @@ class NewPrinterGUI(GtkGUI):
return (host, uri)
def fillDeviceTab(self, current_uri=None):
@@ -232,7 +246,7 @@ diff -up system-config-printer-1.1.12/sy
+ except:
+ nonfatalException()
+ return
-
++
+ if network:
+ self.fetchDevices_op = None
+ else:
@@ -244,7 +258,7 @@ diff -up system-config-printer-1.1.12/sy
+ kwargs={"network": True},
+ callback=self.got_devices,
+ context=context)
-+
+
+ devices = result
if current_uri:
if devices.has_key (current_uri):
@@ -257,7 +271,7 @@ diff -up system-config-printer-1.1.12/sy
else:
current = cupshelpers.Device (current_uri)
current.info = "Current device"
-@@ -5008,7 +5085,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5021,7 +5085,7 @@ class NewPrinterGUI(GtkGUI):
"hal", "beh",
"scsi", "http", "delete"),
devices)
@@ -266,7 +280,7 @@ diff -up system-config-printer-1.1.12/sy
for device in devices:
physicaldevice = PhysicalDevice (device)
try:
-@@ -5016,43 +5093,32 @@ class NewPrinterGUI(GtkGUI):
+@@ -5029,43 +5093,32 @@ class NewPrinterGUI(GtkGUI):
self.devices[i].add_device (device)
except ValueError:
self.devices.append (physicaldevice)
@@ -324,7 +338,7 @@ diff -up system-config-printer-1.1.12/sy
if network:
if devs[0].uri != devs[0].type:
# An actual network printer device. Put this at the top.
-@@ -5062,24 +5128,31 @@ class NewPrinterGUI(GtkGUI):
+@@ -5075,24 +5128,31 @@ class NewPrinterGUI(GtkGUI):
# If this is the currently selected device we need
# to expand the "Network Printer" row so that it
# is visible.
@@ -361,7 +375,7 @@ diff -up system-config-printer-1.1.12/sy
connection_select_path = 0
if current_uri:
model = self.tvNPDeviceURIs.get_model ()
-@@ -5093,6 +5166,9 @@ class NewPrinterGUI(GtkGUI):
+@@ -5106,6 +5166,9 @@ class NewPrinterGUI(GtkGUI):
iter = model.iter_next (iter)
i += 1
@@ -371,7 +385,7 @@ diff -up system-config-printer-1.1.12/sy
column = self.tvNPDeviceURIs.get_column (0)
self.tvNPDeviceURIs.set_cursor (connection_select_path, column)
-@@ -5552,6 +5628,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5565,6 +5628,7 @@ class NewPrinterGUI(GtkGUI):
return False
def on_tvNPDevices_cursor_changed(self, widget):
@@ -379,7 +393,7 @@ diff -up system-config-printer-1.1.12/sy
path, column = widget.get_cursor ()
if path == None:
return
-@@ -5855,8 +5932,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5868,8 +5932,7 @@ class NewPrinterGUI(GtkGUI):
self.network_found = 0
self.lblNetworkFindSearching.show_all ()
finder = probe_printer.PrinterFinder ()
@@ -389,7 +403,7 @@ diff -up system-config-printer-1.1.12/sy
finder.find (host, found_callback)
def found_network_printer_callback (self, new_device):
-@@ -5885,8 +5961,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5898,8 +5961,7 @@ class NewPrinterGUI(GtkGUI):
path = model.get_path (iter)
self.tvNPDevices.set_cursor (path)
else:
@@ -401,7 +415,7 @@ diff -up system-config-printer-1.1.12/sy
self.btnNetworkFind.set_sensitive (True)
diff -up system-config-printer-1.1.12/timedops.py.get-devices system-config-printer-1.1.12/timedops.py
--- system-config-printer-1.1.12/timedops.py.get-devices 2009-08-25 15:01:41.000000000 +0100
-+++ system-config-printer-1.1.12/timedops.py 2009-09-04 10:41:50.191513591 +0100
++++ system-config-printer-1.1.12/timedops.py 2009-09-04 10:40:54.530391539 +0100
@@ -152,16 +152,25 @@ class OperationThread(threading.Thread):
class TimedOperation(Timed):
Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/F-11/system-config-printer.spec,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -p -r1.283 -r1.284
--- system-config-printer.spec 4 Sep 2009 10:12:44 -0000 1.283
+++ system-config-printer.spec 14 Sep 2009 14:13:20 -0000 1.284
@@ -7,7 +7,7 @@
Summary: A printer administration tool
Name: system-config-printer
Version: 1.1.12
-Release: 8%{?dist}
+Release: 9%{?dist}
License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base
@@ -17,10 +17,11 @@ Source2: http://cyberelk.net/tim/data/py
Patch1: system-config-printer-get_cursor.patch
Patch2: system-config-printer-statereason-icons.patch
Patch3: system-config-printer-icon-load-traceback.patch
-Patch4: system-config-printer-proxy-auth.patch
-Patch5: system-config-printer-ppdippstr.patch
-Patch6: system-config-printer-raw-device-change.patch
-Patch7: system-config-printer-get-devices.patch
+Patch4: system-config-printer-polkit-1.patch
+Patch5: system-config-printer-proxy-auth.patch
+Patch6: system-config-printer-ppdippstr.patch
+Patch7: system-config-printer-raw-device-change.patch
+Patch8: system-config-printer-get-devices.patch
BuildRequires: cups-devel >= 1.2
BuildRequires: python-devel >= 2.4
@@ -72,10 +73,11 @@ the configuration tool.
%patch1 -p1 -b .get_cursor
%patch2 -p1 -b .statereason-icons
%patch3 -p1 -b .icon-load-traceback
-%patch4 -p1 -b .proxy-auth
-%patch5 -p1 -b .ppdippstr
-%patch6 -p1 -b .raw-device-change
-%patch7 -p1 -b .get-devices
+%patch4 -p1 -b .polkit-1
+%patch5 -p1 -b .proxy-auth
+%patch6 -p1 -b .ppdippstr
+%patch7 -p1 -b .raw-device-change
+%patch8 -p1 -b .get-devices
%build
%configure
@@ -177,6 +179,9 @@ rm -rf %buildroot
exit 0
%changelog
+* Mon Sep 14 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-9
+- Fixed traceback when fetching devices (bug #522139).
+
* Fri Sep 4 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-8
- Further speed improvement when fetching devices.
More information about the fedora-extras-commits
mailing list