Hello community, here is the log from the commit of package python-cups for openSUSE:Factory checked in at Mon May 30 16:20:38 CEST 2011.
-------- --- python-cups/python-cups.changes 2010-11-10 14:03:08.000000000 +0100 +++ python-cups/python-cups.changes 2011-05-27 15:39:13.000000000 +0200 @@ -1,0 +2,17 @@ +Fri May 27 15:22:12 CEST 2011 - vu...@opensuse.org + +- Update to version 1.9.55: + + Add: + - cups.IPP_QUALITY_DRAFT, cups.IPP_QUALITY_NORMAL, + cups.IPP_QUALITY_HIGH + - cups.IPP_PORTRAIT, cups.IPP_LANDSCAPE, + cups.IPP_REVERSE_PORTRAIT, cups.IPP_REVERSE_LANDSCAPE + - cups.IPP_RES_UNITS_CM, cups.IPP_RES_UNITS_INCH + + Support for IPP_TAG_RESOLUTION as triplet (xres, yres, units). +- Changes from version 1.9.54: + + Add rpm 4.9 hooks that can tag printer driver RPM packages with + the MFG and MDL values for devices they support. +- Changes from version 1.9.53: + + Fix a thread-local storage issue (rh#662805). + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- pycups-1.9.52.tar.bz2 New: ---- pycups-1.9.55.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cups.spec ++++++ --- /var/tmp/diff_new_pack.bKun65/_old 2011-05-30 16:19:58.000000000 +0200 +++ /var/tmp/diff_new_pack.bKun65/_new 2011-05-30 16:19:58.000000000 +0200 @@ -1,7 +1,7 @@ # -# spec file for package python-cups (Version 1.9.52) +# spec file for package python-cups # -# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ Name: python-cups %define _name pycups BuildRequires: cups-devel python-devel -Version: 1.9.52 +Version: 1.9.55 Release: 1 Group: Development/Libraries/Python License: GPLv2+ @@ -38,11 +38,11 @@ %setup -q -n %{_name}-%{version} %build -CFLAGS="%{optflags} -DVERSION=\\\"%version\\\"" \ -%{__python} setup.py build +CFLAGS="%{optflags}" %{__python} setup.py build %install %{__python} setup.py install --prefix=%{_prefix} --root %{buildroot} +make install-rpmhook DESTDIR=%{buildroot} %clean %{__rm} -rf %{buildroot} @@ -51,5 +51,7 @@ %defattr(-,root,root) %{py_sitedir}/cups.so %{py_sitedir}/%{_name}-%{version}-py%{python_version}.egg-info +%{_rpmconfigdir}/fileattrs/psdriver.attr +%{_rpmconfigdir}/postscriptdriver.prov %changelog ++++++ pycups-1.9.52.tar.bz2 -> pycups-1.9.55.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/ChangeLog new/pycups-1.9.55/ChangeLog --- old/pycups-1.9.52/ChangeLog 2010-11-01 14:30:44.000000000 +0100 +++ new/pycups-1.9.55/ChangeLog 2011-03-20 14:42:36.000000000 +0100 @@ -1,3 +1,49 @@ +2011-03-20 Tim Waugh <twa...@redhat.com> + + * setup.py: Version 1.9.55. + +2011-02-24 Tim Waugh <twa...@redhat.com> + + * cupsmodule.c (initcups): IPP orientation and quality + constants. + + * cupsconnection.c (PyObject_from_attr_value): Support for + IPP_TAG_RESOLUTION. + + * cupsmodule.c (initcups): IPP_RES_PER_CM and IPP_RES_PER_INCH. + +2011-02-23 Tim Waugh <twa...@redhat.com> + + * setup.py: Version 1.9.54. + +2011-02-23 Tim Waugh <twa...@redhat.com> + + * cupsconnection.c (Connection_begin_allow_threads): Avoid + 'unused variable' warning. + +2011-02-23 Tim Waugh <twa...@redhat.com> + + * psdriver.attr, postscriptdriver.prov: RPM hooks for tagging + packages with Device IDs of models supported by drivers. + * Makefile: Install RPM hooks if rpm is available. + +2011-02-03 Tim Waugh <twa...@redhat.com> + + * cupsconnection.c (Connection_deletePrinterFromClass): More + defensive coding (bug #673468). + +2010-12-15 Tim Waugh <twa...@redhat.com> + + * setup.py: Version 1.9.53. + +2010-12-15 Tim Waugh <twa...@redhat.com> + + * cupsmodule.h: Declare new function get_TLS and its data + structure. + * cupsmodule.c: Implement it. + * cupsmodule.c, cupsconnection.c: Use thread-local storage for + CUPS password callback (bug #662805). + 2010-11-01 Tim Waugh <twa...@redhat.com> * setup.py: Version 1.9.52. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/Makefile new/pycups-1.9.55/Makefile --- old/pycups-1.9.52/Makefile 2010-05-18 14:19:13.000000000 +0200 +++ new/pycups-1.9.55/Makefile 2011-02-23 12:18:53.000000000 +0100 @@ -1,8 +1,10 @@ NAME=pycups VERSION:=$(shell python setup.py --version) +RPMCONFIGDIR:=$(shell rpm -E "%{_rpmconfigdir}" 2>/dev/null || :) SOURCES=cupsmodule.c cupsconnection.c cupsppd.c cupsipp.c setup.py \ - cupsppd.h cupsipp.h cupsconnection.h cupsmodule.h + cupsppd.h cupsipp.h cupsconnection.h cupsmodule.h \ + psdriver.attr postscriptdriver.prov DIST=Makefile test.py \ examples \ @@ -10,7 +12,7 @@ cups.so: $(SOURCES) python setup.py build - mv build/lib*/$@ . + ln -sf build/lib*/$@ . doc: cups.so rm -rf html @@ -26,10 +28,18 @@ tar jcf $(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION) rm -rf $(NAME)-$(VERSION) -install: +install: install-rpmhook ROOT= ; \ if [ -n "$$DESTDIR" ]; then ROOT="--root $$DESTDIR"; fi; \ - python setup.py install $$ROOT + python setup.py install --skip-build $$ROOT -.PHONY: doc clean dist install +install-rpmhook: + if [ -n "$(RPMCONFIGDIR)" ]; then \ + RPMCONFIG="$$DESTDIR$(RPMCONFIGDIR)" ; \ + mkdir -p "$$RPMCONFIG"/fileattrs ; \ + install -m0644 psdriver.attr "$$RPMCONFIG"/fileattrs/ ; \ + install -m0755 postscriptdriver.prov "$$RPMCONFIG"/ ; \ + fi + +.PHONY: doc clean dist install install-rpmhook diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/NEWS new/pycups-1.9.55/NEWS --- old/pycups-1.9.52/NEWS 2010-10-20 13:53:35.000000000 +0200 +++ new/pycups-1.9.55/NEWS 2011-02-24 13:04:39.000000000 +0100 @@ -1,6 +1,15 @@ NEWS ---- +New in 1.9.55: + +* cups.IPP_QUALITY_DRAFT, cups.IPP_QUALITY_NORMAL, + cups.IPP_QUALITY_HIGH +* cups.IPP_PORTRAIT, cups.IPP_LANDSCAPE, cups.IPP_REVERSE_PORTRAIT, + cups.IPP_REVERSE_LANDSCAPE +* cups.IPP_RES_UNITS_CM, cups.IPP_RES_UNITS_INCH +* Support for IPP_TAG_RESOLUTION as triplet (xres, yres, units). + New in 1.9.52: * cups.Connection.getPPDs2(): New method, identical to getPPDs() but diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/cupsconnection.c new/pycups-1.9.55/cupsconnection.c --- old/pycups-1.9.52/cupsconnection.c 2010-10-20 16:17:12.000000000 +0200 +++ new/pycups-1.9.55/cupsconnection.c 2011-02-24 14:04:24.000000000 +0100 @@ -1,6 +1,6 @@ /* * cups - Python bindings for CUPS - * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc + * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc * Author: Tim Waugh <twa...@redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -291,11 +291,14 @@ void Connection_begin_allow_threads (void *connection) { +#ifndef HAVE_CUPS_1_4 + struct TLS *tls = get_TLS (); +#endif /* !HAVE_CUPS_1_4 */ Connection *self = (Connection *) connection; debugprintf ("begin allow threads\n"); #ifndef HAVE_CUPS_1_4 - g_current_connection = connection; + tls->g_current_connection = connection; #endif /* !HAVE_CUPS_1_4 */ self->tstate = PyEval_SaveThread (); @@ -323,6 +326,7 @@ const char *resource, void *user_data) { + struct TLS *tls = get_TLS (); PyObject *cb_context = user_data; Connection *self = NULL; PyObject *args; @@ -358,7 +362,7 @@ } else args = Py_BuildValue ("(s)", prompt); - result = PyEval_CallObject (cups_password_callback, args); + result = PyEval_CallObject (tls->cups_password_callback, args); Py_DECREF (args); if (result == NULL) { @@ -552,6 +556,7 @@ PyObject_from_attr_value (ipp_attribute_t *attr, int i) { PyObject *val = NULL; + char unknown[100]; switch (attr->value_tag) { case IPP_TAG_NAME: case IPP_TAG_TEXT: @@ -583,8 +588,16 @@ case IPP_TAG_DATE: val = PyString_FromString ("(IPP_TAG_DATE)"); break; + case IPP_TAG_RESOLUTION: + val = Py_BuildValue ("(iii)", + attr->values[i].resolution.xres, + attr->values[i].resolution.yres, + attr->values[i].resolution.units); + break; default: - val = PyString_FromString ("(unknown IPP tag)"); + snprintf (unknown, sizeof (unknown), + "(unknown IPP value tag 0x%x)", attr->value_tag); + val = PyString_FromString (unknown); break; } @@ -3144,6 +3157,7 @@ case IPP_TAG_LANGUAGE: case IPP_TAG_ENUM: case IPP_TAG_INTEGER: + case IPP_TAG_RESOLUTION: is_list = !strcmp (attr->name + namelen - 10, "-supported"); if (!is_list) { @@ -3277,6 +3291,10 @@ static PyObject * Connection_deletePrinterFromClass (Connection *self, PyObject *args) { + const char *requested_attrs[] = { + "member-names", + "member-uris" + }; PyObject *printernameobj; char *printername; PyObject *classnameobj; @@ -3304,6 +3322,10 @@ free (classname); ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, classuri); + ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", + sizeof(requested_attrs) / sizeof(requested_attrs[0]), + NULL, requested_attrs); Connection_begin_allow_threads (self); answer = cupsDoRequest (self->http, request, "/"); Connection_end_allow_threads (self); @@ -3325,6 +3347,13 @@ return NULL; } + printers = ippFindAttribute (answer, "member-uris", IPP_TAG_URI); + if (!printers || i >= printers->num_values) { + ippDelete (answer); + PyErr_SetString (PyExc_RuntimeError, "No member URIs returned"); + return NULL; + } + request = ippNewRequest (CUPS_ADD_CLASS); ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, classuri); @@ -3336,7 +3365,6 @@ // Trim the printer from the list. ipp_attribute_t *newlist; int j; - printers = ippFindAttribute (answer, "member-uris", IPP_TAG_URI); newlist = ippAddStrings (request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris", printers->num_values - 1, NULL, NULL); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/cupsmodule.c new/pycups-1.9.55/cupsmodule.c --- old/pycups-1.9.52/cupsmodule.c 2010-05-11 17:29:00.000000000 +0200 +++ new/pycups-1.9.55/cupsmodule.c 2011-02-24 13:03:33.000000000 +0100 @@ -1,6 +1,6 @@ /* * cups - Python bindings for CUPS - * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc + * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc * Author: Tim Waugh <twa...@redhat.com> * * This program is free software; you can redistribute it and/or modify @@ -26,6 +26,7 @@ #include "cupsmodule.h" #include <locale.h> +#include <pthread.h> #include <wchar.h> #include <wctype.h> @@ -33,18 +34,47 @@ #include "cupsppd.h" #include "cupsipp.h" -PyObject *cups_password_callback = NULL; - -#ifdef HAVE_CUPS_1_4 -PyObject *cups_password_callback_context = NULL; -#else /* !HAVE_CUPS_1_4 */ -void *g_current_connection = NULL; -#endif /* !HAVE_CUPS_1_4 */ +static pthread_key_t tls_key = -1; +static pthread_once_t tls_key_once = PTHREAD_ONCE_INIT; ////////////////////// // Worker functions // ////////////////////// +static void +destroy_TLS (void *value) +{ + struct TLS *tls = (struct TLS *) value; + Py_XDECREF (tls->cups_password_callback); + +#if HAVE_CUPS_1_4 + Py_XDECREF (tls->cups_password_callback_context); +#endif /* HAVE_CUPS_1_4 */ + + free (value); +} + +static void +init_TLS (void) +{ + pthread_key_create (&tls_key, destroy_TLS); +} + +struct TLS * +get_TLS (void) +{ + struct TLS *tls; + pthread_once (&tls_key_once, init_TLS); + tls = (struct TLS *) pthread_getspecific (tls_key); + if (tls == NULL) + { + tls = calloc (1, sizeof (struct TLS)); + pthread_setspecific (tls_key, tls); + } + + return tls; +} + static int do_model_compare (const wchar_t *a, const wchar_t *b) { @@ -112,6 +142,7 @@ static const char * do_password_callback (const char *prompt) { + struct TLS *tls = get_TLS (); static char *password; PyObject *args; @@ -119,14 +150,14 @@ const char *pwval; debugprintf ("-> do_password_callback\n"); - Connection_end_allow_threads (g_current_connection); + Connection_end_allow_threads (tls->g_current_connection); args = Py_BuildValue ("(s)", prompt); result = PyEval_CallObject (cups_password_callback, args); Py_DECREF (args); if (result == NULL) { debugprintf ("<- do_password_callback (empty string)\n"); - Connection_begin_allow_threads (g_current_connection); + Connection_begin_allow_threads (tls->g_current_connection); return ""; } @@ -141,11 +172,11 @@ if (!password) { debugprintf ("<- do_password_callback (empty string)\n"); - Connection_begin_allow_threads (g_current_connection); + Connection_begin_allow_threads (tls->g_current_connection); return ""; } - Connection_begin_allow_threads (g_current_connection); + Connection_begin_allow_threads (tls->g_current_connection); debugprintf ("<- do_password_callback\n"); return password; } @@ -296,7 +327,7 @@ static PyObject * cups_setPasswordCB (PyObject *self, PyObject *args) { - static PyObject *current_cb_context; + struct TLS *tls = get_TLS (); PyObject *cb; if (!PyArg_ParseTuple (args, "O:cups_setPasswordCB", &cb)) @@ -308,12 +339,12 @@ } debugprintf ("-> cups_setPasswordCB\n"); - Py_XDECREF (current_cb_context); - current_cb_context = NULL; + Py_XDECREF (tls->cups_password_callback_context); + tls->cups_password_callback_context = NULL; Py_XINCREF (cb); - Py_XDECREF (cups_password_callback); - cups_password_callback = cb; + Py_XDECREF (tls->cups_password_callback); + tls->cups_password_callback = cb; #ifdef HAVE_CUPS_1_4 cupsSetPasswordCB2 (password_callback_oldstyle, NULL); @@ -330,7 +361,7 @@ static PyObject * cups_setPasswordCB2 (PyObject *self, PyObject *args) { - static PyObject *current_cb_context; + struct TLS *tls = get_TLS (); PyObject *cb; PyObject *cb_context = NULL; @@ -349,20 +380,20 @@ debugprintf ("-> cups_setPasswordCB2\n"); Py_XINCREF (cb_context); - Py_XDECREF (current_cb_context); - current_cb_context = cb_context; + Py_XDECREF (tls->cups_password_callback_context); + tls->cups_password_callback_context = cb_context; if (cb == Py_None) { - Py_XDECREF (cups_password_callback); - cups_password_callback = NULL; + Py_XDECREF (tls->cups_password_callback); + tls->cups_password_callback = NULL; cupsSetPasswordCB2 (NULL, NULL); } else { Py_XINCREF (cb); - Py_XDECREF (cups_password_callback); - cups_password_callback = cb; + Py_XDECREF (tls->cups_password_callback); + tls->cups_password_callback = cb; cupsSetPasswordCB2 (password_callback_newstyle, cb_context); } @@ -679,6 +710,10 @@ INT_CONSTANT (IPP_PRINTER_PROCESSING); INT_CONSTANT (IPP_PRINTER_STOPPED); + // IPP resolution units + INT_CONSTANT (IPP_RES_PER_CM); + INT_CONSTANT (IPP_RES_PER_INCH); + // IPP finishings INT_CONSTANT (IPP_FINISHINGS_NONE); INT_CONSTANT (IPP_FINISHINGS_STAPLE); @@ -709,6 +744,17 @@ INT_CONSTANT (IPP_FINISHINGS_BIND_RIGHT); INT_CONSTANT (IPP_FINISHINGS_BIND_BOTTOM); + // IPP orientations + INT_CONSTANT (IPP_PORTRAIT); + INT_CONSTANT (IPP_LANDSCAPE); + INT_CONSTANT (IPP_REVERSE_PORTRAIT); + INT_CONSTANT (IPP_REVERSE_LANDSCAPE); + + // IPP qualities + INT_CONSTANT (IPP_QUALITY_DRAFT); + INT_CONSTANT (IPP_QUALITY_NORMAL); + INT_CONSTANT (IPP_QUALITY_HIGH); + // IPP errors INT_CONSTANT (IPP_OK); INT_CONSTANT (IPP_OK_SUBST); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/cupsmodule.h new/pycups-1.9.55/cupsmodule.h --- old/pycups-1.9.52/cupsmodule.h 2009-12-18 12:07:59.000000000 +0100 +++ new/pycups-1.9.55/cupsmodule.h 2010-12-15 14:44:19.000000000 +0100 @@ -1,6 +1,6 @@ /* * cups - Python bindings for CUPS - * Copyright (C) 2006, 2007, 2008, 2009 Tim Waugh <twa...@redhat.com> + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Tim Waugh <twa...@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 @@ -53,12 +53,16 @@ #error pycups requires CUPS 1.2.x #endif -extern PyObject *cups_password_callback; - +struct TLS +{ + PyObject *cups_password_callback; #ifdef HAVE_CUPS_1_4 -extern PyObject *cups_password_callback_context; + PyObject *cups_password_callback_context; #else /* !HAVE_CUPS_1_4 */ -extern void *g_current_connection; + void *g_current_connection; #endif /* !HAVE_CUPS_1_4 */ +}; + +extern struct TLS *get_TLS (void); #endif /* HAVE_CUPSMODULE_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/postscriptdriver.prov new/pycups-1.9.55/postscriptdriver.prov --- old/pycups-1.9.52/postscriptdriver.prov 1970-01-01 01:00:00.000000000 +0100 +++ new/pycups-1.9.55/postscriptdriver.prov 2011-02-23 10:52:56.000000000 +0100 @@ -0,0 +1,259 @@ +#!/usr/bin/python + +## Copyright (C) 2009, 2010 Red Hat, Inc. +## Author: Tim Waugh <twa...@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 + +try: + import cups + CAN_EXAMINE_PPDS = True +except: + CAN_EXAMINE_PPDS = False + +from getopt import getopt +import errno +import os +import posix +import re +import shlex +import signal +import subprocess +import sys +import tempfile + +if len (sys.argv) > 1: + RPM_BUILD_ROOT = sys.argv[1] +else: + RPM_BUILD_ROOT = None + +class TimedOut(Exception): + def __init__ (self): + Exception.__init__ (self, "Timed out") + +class DeviceIDs: + def __init__ (self): + self.ids = dict() + + def get_dict (self): + return self.ids + + def get_tags (self): + ret = [] + for mfg, mdlset in self.ids.iteritems (): + mfgl = mfg.lower ().replace (" ", "_") + for mdl in mdlset: + mdll = mdl.lower ().replace (" ", "_") + ret.append ("postscriptdriver(%s;%s;)" % (mfgl, + mdll)) + + return ret + + def __add__ (self, other): + if isinstance(other, DeviceIDs): + for omfg, omdlset in other.ids.iteritems (): + try: + mdlset = self.ids[omfg] + except KeyError: + mdlset = set() + self.ids[omfg] = mdlset + + mdlset.update (omdlset) + + return self + + pieces = other.split (';') + mfg = mdl = None + for piece in pieces: + s = piece.split (":") + if len (s) != 2: + continue + key, value = s + key = key.upper ().strip () + if key in ["MFG", "MANUFACTURER"]: + mfg = value.strip () + elif key in ["MDL", "MODEL"]: + mdl = value.strip () + + if mfg and mdl: + try: + mdlset = self.ids[mfg] + except KeyError: + mdlset = set() + self.ids[mfg] = mdlset + + mdlset.add (mdl) + + return self + +class Driver: + def __init__ (self): + self.ids = DeviceIDs() + + def list (self): + return self.ids + +class PPDDriver(Driver): + def __init__ (self, pathname=None): + Driver.__init__ (self) + self.pathname = pathname + + def list (self): + if self.pathname != None: + self.examine_file (self.pathname) + + return Driver.list (self) + + def examine_file (self, path): + try: + ppd = cups.PPD (path) + except RuntimeError, e: + # Not a PPD file. Perhaps it's a drv file. + drv = DrvDriver (path) + self.ids += drv.list () + return + + attr = ppd.findAttr ('1284DeviceID') + while attr: + self.ids += attr.value + attr = ppd.findNextAttr ('1284DeviceID') + +class DynamicDriver(Driver): + def __init__ (self, driver): + Driver.__init__ (self) + self.driver = driver + signal.signal (signal.SIGALRM, self._alarm) + + def _alarm (self, sig, stack): + raise TimedOut + + def list (self): + signal.alarm (60) + env = os.environ.copy () + if RPM_BUILD_ROOT: + buildroot = RPM_BUILD_ROOT + if not buildroot.endswith (os.path.sep): + buildroot += os.path.sep + + env["DESTDIR"] = RPM_BUILD_ROOT + env["LD_LIBRARY_PATH"] = "%susr/lib64:%susr/lib" % (buildroot, + buildroot) + + p = subprocess.Popen ([self.driver, "list"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + env=env) + try: + (stdout, stderr) = p.communicate () + signal.alarm (0) + except TimedOut: + posix.kill (p.pid, signal.SIGKILL) + raise + + if stderr: + print >> sys.stderr, stderr + + ppds = [] + lines = stdout.split ('\n') + for line in lines: + l = shlex.split (line) + if len (l) < 5: + continue + self.ids += l[4] + + return Driver.list (self) + +class DrvDriver(PPDDriver): + def __init__ (self, pathname): + PPDDriver.__init__ (self) + self.drv = pathname + + def _alarm (self, sig, stack): + raise TimedOut + + def list (self): + tmpdir = os.environ.get ("TMPDIR", "/tmp") + os.path.sep + outputdir = tempfile.mkdtemp (dir=tmpdir) + + argv = [ "ppdc", + "-d", outputdir, + "-I", "/usr/share/cups/ppdc", + self.drv ] + + signal.alarm (60) + try: + p = subprocess.Popen (argv, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + except OSError: + # ppdc not available. + os.rmdir (outputdir) + return Driver.list (self) + + try: + (stdout, stderr) = p.communicate () + signal.alarm (0) + except TimedOut: + posix.kill (p.pid, signal.SIGKILL) + raise + + os.path.walk (outputdir, self.examine_directory, None) + os.rmdir (outputdir) + return Driver.list (self) + + def examine_directory (self, unused, dirname, fnames): + for fname in fnames: + path = dirname + os.path.sep + fname + self.examine_file (path) + os.unlink (path) + +class TagBuilder: + def __init__ (self, filelist=None): + if filelist == None: + filelist = sys.stdin + + paths = map (lambda x: x.rstrip (), filelist.readlines ()) + self.ids = DeviceIDs () + + for path in paths: + if path.find ("/usr/lib/cups/driver/") != -1: + try: + self.ids += DynamicDriver (path).list () + except TimedOut: + pass + except OSError, (e, s): + if e == errno.EACCES or e == errno.ENOENT: + # Not executable + pass + else: + raise + + if CAN_EXAMINE_PPDS: + for path in paths: + try: + self.ids += PPDDriver (path).list () + except TimedOut: + pass + + def get_tags (self): + return self.ids.get_tags () + +if __name__ == "__main__": + builder = TagBuilder () + tags = builder.get_tags () + for tag in tags: + print tag diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/psdriver.attr new/pycups-1.9.55/psdriver.attr --- old/pycups-1.9.52/psdriver.attr 1970-01-01 01:00:00.000000000 +0100 +++ new/pycups-1.9.55/psdriver.attr 2011-02-23 10:52:53.000000000 +0100 @@ -0,0 +1,3 @@ +%__psdriver_provides %{_rpmconfigdir}/postscriptdriver.prov +%__psdriver_path ^(/usr/lib/cups/driver/.*|%{_datadir}/cups/drv/.*\.drv)$ +%__psdriver_magic ^PPD file.*$ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycups-1.9.52/setup.py new/pycups-1.9.55/setup.py --- old/pycups-1.9.52/setup.py 2010-11-01 14:30:37.000000000 +0100 +++ new/pycups-1.9.55/setup.py 2011-03-20 14:42:23.000000000 +0100 @@ -1,5 +1,5 @@ from distutils.core import setup, Extension -VERSION="1.9.52" +VERSION="1.9.55" setup (name="pycups", version=VERSION, ext_modules=[Extension("cups", ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org