diff -up kdeadmin-4.5.80/system-config-printer-kde/CMakeLists.txt.printing kdeadmin-4.5.80/system-config-printer-kde/CMakeLists.txt --- kdeadmin-4.5.80/system-config-printer-kde/CMakeLists.txt.printing 2010-07-29 04:59:43.000000000 -0500 +++ kdeadmin-4.5.80/system-config-printer-kde/CMakeLists.txt 2010-11-21 14:30:45.782376008 -0600 @@ -5,29 +5,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PAT macro_optional_find_package(PythonLibrary) macro_optional_find_package(SIP) -macro_optional_find_package(PyQt4) -IF(NOT PYQT4_FOUND) - macro_log_feature(PYQT4_FOUND "PyQt4" "PyQt4 was not found. It is needed by system-config-printer-kde to run. (Use -DINSTALL_SYSTEM_CONFIG_PRINTER=TRUE to install anyway)" "http://www.riverbankcomputing.co.uk/pyqt/" FALSE) -ENDIF(NOT PYQT4_FOUND) +if(PYTHONLIBRARY_FOUND) + set(INSTALL_SYSTEM_CONFIG_PRINTER TRUE) +endif(PYTHONLIBRARY_FOUND) -macro_optional_find_package(PyKDE4) -IF(NOT PYKDE4_FOUND) - macro_log_feature(PYKDE_FOUND "PyKDE4" "PyKDE4 was not found. It is needed by system-config-printer-kde to run. (Use -DINSTALL_SYSTEM_CONFIG_PRINTER=TRUE to install anyway)" "http://websvn.kde.org/trunk/KDE/kdebindings/python/pykde4/" FALSE) -ENDIF(NOT PYKDE4_FOUND) - -macro_optional_find_package(PyCups) -IF(NOT PYCUPS_FOUND) - macro_log_feature(PYCUPS_FOUND "PyCups" "PyCups was not found. It is needed by system-config-printer-kde to run. (Use -DINSTALL_SYSTEM_CONFIG_PRINTER=TRUE to install anyway)" "http://cyberelk.net/tim/software/pycups/" FALSE) -ENDIF(NOT PYCUPS_FOUND) - -macro_optional_find_package(SystemConfigPrinter) -IF(NOT SYSTEMCONFIGPRINTER_FOUND) - macro_log_feature(SYSTEMCONFIGPRINTER_FOUND "system-config-printer" "system-config-printer was not found. Some of its modules (cupshelpers modules, config.py, smburi.py and debug.py) are required by system-config-printer-kde." "http://cyberelk.net/tim/software/system-config-printer/" FALSE) -ENDIF(NOT SYSTEMCONFIGPRINTER_FOUND) - -IF(PYQT4_FOUND AND PYKDE4_FOUND AND PYCUPS_FOUND AND SYSTEMCONFIGPRINTER_FOUND) - SET(INSTALL_SYSTEM_CONFIG_PRINTER TRUE) -ENDIF(PYQT4_FOUND AND PYKDE4_FOUND AND PYCUPS_FOUND AND SYSTEMCONFIGPRINTER_FOUND) IF(INSTALL_SYSTEM_CONFIG_PRINTER) install( FILES @@ -36,6 +17,8 @@ IF(INSTALL_SYSTEM_CONFIG_PRINTER) system-config-printer-kde.py options.py optionwidgets.py + debug.py + smburi.py ipp-browse-dialog.ui smb-browse-dialog.ui DESTINATION ${DATA_INSTALL_DIR}/system-config-printer-kde ) diff -up kdeadmin-4.5.80/system-config-printer-kde/debug.py.printing kdeadmin-4.5.80/system-config-printer-kde/debug.py --- kdeadmin-4.5.80/system-config-printer-kde/debug.py.printing 2010-11-21 14:28:59.417362713 -0600 +++ kdeadmin-4.5.80/system-config-printer-kde/debug.py 2010-11-21 14:28:59.417362713 -0600 @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +## Copyright (C) 2008 Red Hat, Inc. +## Copyright (C) 2008 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 +## 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 sys +import traceback + +_debug=False +def debugprint (x): + if _debug: + try: + print >>sys.stderr, x + except: + pass + +def get_debugging (): + return _debug + +def set_debugging (d): + global _debug + _debug = d + +def fatalException (exitcode=1): + nonfatalException (type="fatal", end="Exiting") + sys.exit (exitcode) + +def nonfatalException (type="non-fatal", end="Continuing anyway.."): + d = get_debugging () + set_debugging (True) + debugprint ("Caught %s exception. Traceback:" % type) + (type, value, tb) = sys.exc_info () + tblast = traceback.extract_tb (tb, limit=None) + if len (tblast): + tblast = tblast[:len (tblast) - 1] + extxt = traceback.format_exception_only (type, value) + for line in traceback.format_tb(tb): + debugprint (line.strip ()) + debugprint (extxt[0].strip ()) + debugprint (end) + set_debugging (d) diff -up kdeadmin-4.5.80/system-config-printer-kde/smburi.py.printing kdeadmin-4.5.80/system-config-printer-kde/smburi.py --- kdeadmin-4.5.80/system-config-printer-kde/smburi.py.printing 2010-11-21 14:28:59.418362782 -0600 +++ kdeadmin-4.5.80/system-config-printer-kde/smburi.py 2010-11-21 14:28:59.417362713 -0600 @@ -0,0 +1,95 @@ +#!/usr/bin/env python + +## system-config-printer + +## Copyright (C) 2006, 2007, 2008 Red Hat, Inc. +## Copyright (C) 2006, 2007 Florian Festi <ffesti@redhat.com> +## Copyright (C) 2006, 2007, 2008 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 +## 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 urllib + +class SMBURI: + def __init__ (self, + uri=None, + group='', host='', share='', user='', password=''): + if uri: + if group or host or share or user or password: + raise RuntimeError + + if uri.startswith ("smb://"): + uri = uri[6:] + + self.uri = uri + else: + self.uri = self._construct (group, host, share, + user=user, password=password) + + def _construct (self, group, host, share, user='', password=''): + uri_password = '' + if password: + uri_password = ':' + urllib.quote (password) + if user: + uri_password += '@' + uri = "%s%s%s" % (urllib.quote (user), + uri_password, + urllib.quote (group)) + if len (group) > 0: + uri += '/' + uri += urllib.quote (host) + if len (share) > 0: + uri += "/" + urllib.quote (share) + return uri + + def get_uri (self): + return self.uri + + def sanitize_uri (self): + group, host, share, user, password = self.separate () + return self._construct (group, host, share) + + def separate (self): + uri = self.get_uri () + user = '' + password = '' + auth = uri.find ('@') + if auth != -1: + u = uri[:auth].find(':') + if u != -1: + user = uri[:u] + password = uri[u + 1:auth] + else: + user = uri[:auth] + uri = uri[auth + 1:] + sep = uri.count ('/') + group = '' + if sep == 2: + g = uri.find('/') + group = uri[:g] + uri = uri[g + 1:] + if sep < 1: + host = '' + else: + h = uri.find('/') + host = uri[:h] + uri = uri[h + 1:] + p = host.find(':') + if p != -1: + host = host[:p] + share = uri + return (urllib.unquote (group), urllib.unquote (host), + urllib.unquote (share), + urllib.unquote (user), urllib.unquote (password)) diff -up kdeadmin-4.5.80/system-config-printer-kde/system-config-printer-kde.py.printing kdeadmin-4.5.80/system-config-printer-kde/system-config-printer-kde.py --- kdeadmin-4.5.80/system-config-printer-kde/system-config-printer-kde.py.printing 2010-07-29 04:59:43.000000000 -0500 +++ kdeadmin-4.5.80/system-config-printer-kde/system-config-printer-kde.py 2010-11-21 14:28:59.421362503 -0600 @@ -34,7 +34,7 @@ import locale import sys, os, time, traceback, re, tempfile, httplib, thread #load modules from system-config-printer-common (debug, smburi), change path here if you have it installed elsewhere -SYSTEM_CONFIG_PRINTER_DIR = "/usr/share/system-config-printer" +SYSTEM_CONFIG_PRINTER_DIR = "/usr/share/kde4/apps/system-config-printer-kde" if os.path.exists(SYSTEM_CONFIG_PRINTER_DIR + "/debug.py"): sys.path.append(SYSTEM_CONFIG_PRINTER_DIR) @@ -66,7 +66,6 @@ import cups cups.require ("1.9.27") # These come from system-config-printer -import config import cupshelpers, options from optionwidgets import OptionWidget from smburi import SMBURI