rpms/kdeutils/devel kdeutils-4.4.1-printer-applet-InstallPrinterDrivers.patch, NONE, 1.1 kdeutils.spec, 1.217, 1.218

Kevin Kofler kkofler at fedoraproject.org
Wed Mar 24 18:56:49 UTC 2010


Author: kkofler

Update of /cvs/pkgs/rpms/kdeutils/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv18674/devel

Modified Files:
	kdeutils.spec 
Added Files:
	kdeutils-4.4.1-printer-applet-InstallPrinterDrivers.patch 
Log Message:
* Wed Mar 24 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 6:4.4.1-2
- -printer-applet: add support for automatic printer driver installation
                   (Tim Waugh, #576660, F13+)
- -printer-applet: add missing Requires: dbus-python
- remove obsolete F10- upgrade path Requires for -printer-applet

kdeutils-4.4.1-printer-applet-InstallPrinterDrivers.patch:
 CMakeLists.txt    |    1 
 installdriver.py  |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 printer-applet.py |   10 +++++++++
 3 files changed, 71 insertions(+)

--- NEW FILE kdeutils-4.4.1-printer-applet-InstallPrinterDrivers.patch ---
diff -up kdeutils-4.4.1/printer-applet/CMakeLists.txt.InstallPrinterDrivers kdeutils-4.4.1/printer-applet/CMakeLists.txt
--- kdeutils-4.4.1/printer-applet/CMakeLists.txt.InstallPrinterDrivers	2009-08-12 10:59:22.000000000 +0100
+++ kdeutils-4.4.1/printer-applet/CMakeLists.txt	2010-03-24 17:35:19.174516425 +0000
@@ -34,6 +34,7 @@ IF(INSTALL_PRINTER_APPLET)
         monitor.py
         authconn.py
         debug.py
+        installdriver.py
         DESTINATION ${DATA_INSTALL_DIR}/printer-applet )
     PYKDE4_ADD_EXECUTABLE(printer-applet.py printer-applet)
     install(FILES printer-applet.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
diff -up kdeutils-4.4.1/printer-applet/installdriver.py.InstallPrinterDrivers kdeutils-4.4.1/printer-applet/installdriver.py
--- kdeutils-4.4.1/printer-applet/installdriver.py.InstallPrinterDrivers	2010-03-24 17:35:19.175516691 +0000
+++ kdeutils-4.4.1/printer-applet/installdriver.py	2010-03-24 17:35:19.176515999 +0000
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+## system-config-printer
+
+## Copyright (C) 2010 Red Hat, Inc.
+## Author: Tim Waugh <twaugh at 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
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import dbus
+import dbus.glib
+import dbus.service
+
+class PrinterDriversInstaller(dbus.service.Object):
+    DBUS_PATH  = "/com/redhat/PrinterDriversInstaller"
+    DBUS_IFACE = "com.redhat.PrinterDriversInstaller"
+    DBUS_OBJ   = "com.redhat.PrinterDriversInstaller"
+
+    def __init__ (self, bus):
+        self.bus = bus
+        bus_name = dbus.service.BusName (self.DBUS_OBJ, bus=bus)
+        dbus.service.Object.__init__ (self, bus_name, self.DBUS_PATH)
+
+    @dbus.service.method(DBUS_IFACE,
+                         in_signature="sss",
+                         async_callbacks=("reply_handler",
+                                          "error_handler"))
+    def InstallDrivers (self, mfg, mdl, cmd,
+                       reply_handler, error_handler):
+        bus = dbus.SessionBus ()
+        obj = bus.get_object ("org.freedesktop.PackageKit",
+                              "/org/freedesktop/PackageKit")
+        proxy = dbus.Interface (obj, "org.freedesktop.PackageKit.Modify")
+        proxy.InstallPrinterDrivers (0, ["MFG:%s;MDL:%s;" % (mfg, mdl)],
+                                     "hide-finished",
+                                     reply_handler=reply_handler,
+                                     error_handler=error_handler,
+                                     timeout=3600)
+
+if __name__ == "__main__":
+    bus = dbus.SystemBus ()
+    import sys
+    if len (sys.argv) < 2 or sys.argv[1] == "--client":
+        # Client
+        obj = bus.get_object (PrinterDriversInstaller.DBUS_OBJ,
+                              PrinterDriversInstaller.DBUS_PATH)
+        proxy = dbus.Interface (obj, PrinterDriversInstaller.DBUS_IFACE)
+        print proxy.InstallDrivers ("MFG", "MDL", "CMD")
diff -up kdeutils-4.4.1/printer-applet/printer-applet.py.InstallPrinterDrivers kdeutils-4.4.1/printer-applet/printer-applet.py
--- kdeutils-4.4.1/printer-applet/printer-applet.py.InstallPrinterDrivers	2010-01-31 19:34:24.000000000 +0000
+++ kdeutils-4.4.1/printer-applet/printer-applet.py	2010-03-24 17:36:22.429515862 +0000
@@ -66,6 +66,7 @@ import dbus.service
 from statereason import StateReason
 import monitor
 import authconn
+import installdriver
 from debug import *
 
 class PrinterURIIndex:
@@ -298,6 +299,15 @@ class JobManager(QObject, monitor.Watche
         except ImportError:
             pass  # cupshelpers not installed, no new printer notification will be shown
 
+        try:
+            installdriver.PrinterDriversInstaller(bus)
+        except Exception, e:
+            try:
+                print >> sys.stderr, ("failed to start PrinterDriversInstaller "
+                                      "service: %s" % e)
+            except:
+                pass
+
     def cleanup (self):
         self.monitor.cleanup ()
         if self.exit_handler:


Index: kdeutils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdeutils/devel/kdeutils.spec,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -p -r1.217 -r1.218
--- kdeutils.spec	28 Feb 2010 02:57:35 -0000	1.217
+++ kdeutils.spec	24 Mar 2010 18:56:48 -0000	1.218
@@ -6,7 +6,7 @@
 Name:           kdeutils
 Epoch:          6
 Version:        4.4.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        KDE Utilities
 
 Group:          Applications/System
@@ -16,6 +16,9 @@ URL:            http://www.kde.org
 Source0:        ftp://ftp.kde.org/pub/kde/stable/%{version}/src/%{name}-%{version}.tar.bz2
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+# add support for automatic printer driver installation (Tim Waugh, #576660)
+Patch0:         kdeutils-4.4.1-printer-applet-InstallPrinterDrivers.patch
+
 Patch1:         kdeutils-4.2.85-pykde4.patch
 
 ## upstreamed patches
@@ -36,12 +39,7 @@ BuildRequires:  qca2-devel
 BuildRequires:  qimageblitz-devel
 BuildRequires:  xz-devel
 
-%if 0%{?printer_applet}
-%if 0%{?fedora} &&  0%{?fedora} < 11
-# upgrade path so it doesn't get lost
-Requires: %{name}-printer-applet = %{epoch}:%{version}-%{release}
-%endif
-%else
+%if ! 0%{?printer_applet}
 Obsoletes: %{name}-printer-applet < %{epoch}:%{version}-%{release}
 %endif
 
@@ -81,7 +79,8 @@ Requires: kdelibs4%{?_isa} >= %{version}
 %package printer-applet
 Summary:  KDE printer applet
 Group:    Applications/System
-Requires: PyKDE4 
+Requires: PyKDE4
+Requires: dbus-python
 Requires: hal-cups-utils
 Requires: system-config-printer-libs
 %description printer-applet
@@ -90,6 +89,9 @@ Requires: system-config-printer-libs
 
 %prep
 %setup -q -n kdeutils-%{version}
+%if 0%{?fedora} > 12
+%patch0 -p1 -b .InstallPrinterDrivers
+%endif
 
 # NEEDSWORK
 #patch1 -p1 -b .pykde4
@@ -215,6 +217,12 @@ fi
 
 
 %changelog
+* Wed Mar 24 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 6:4.4.1-2
+- -printer-applet: add support for automatic printer driver installation
+                   (Tim Waugh, #576660, F13+)
+- -printer-applet: add missing Requires: dbus-python
+- remove obsolete F10- upgrade path Requires for -printer-applet
+
 * Sat Feb 27 2010 Rex Dieter <rdieter at fedoraproject.org> - 6:4.4.1-1
 - 4.4.1
 



More information about the scm-commits mailing list