teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.8.0-psdriver.patch

Panu Matilainen aa664c
diff -up rpm-4.8.0/build/rpmfc.c.postscriptdriver rpm-4.8.0/build/rpmfc.c
Panu Matilainen aa664c
--- rpm-4.8.0/build/rpmfc.c.postscriptdriver	2010-02-04 12:00:09.802558577 +0000
Panu Matilainen aa664c
+++ rpm-4.8.0/build/rpmfc.c	2010-02-04 12:00:09.894684178 +0000
Panu Matilainen aa664c
@@ -489,6 +489,7 @@ static const struct rpmfcTokens_s const 
Panu Matilainen aa664c
   { " font metrics",		RPMFC_WHITE|RPMFC_INCLUDE },
Panu Matilainen aa664c
   { " font",			RPMFC_FONT|RPMFC_INCLUDE },
Panu Matilainen aa664c
   { " Font",			RPMFC_FONT|RPMFC_INCLUDE },
Panu Matilainen aa664c
+  { "PPD file",			RPMFC_PSDRIVER|RPMFC_INCLUDE },
Panu Matilainen aa664c
 
Panu Matilainen aa664c
   { " commands",		RPMFC_SCRIPT|RPMFC_INCLUDE },
Panu Matilainen aa664c
   { " script",			RPMFC_SCRIPT|RPMFC_INCLUDE },
Panu Matilainen aa664c
@@ -1185,6 +1186,11 @@ exit:
Panu Matilainen aa664c
 #endif
Panu Matilainen aa664c
 }
Panu Matilainen aa664c
 
Panu Matilainen aa664c
+static int rpmfcPSDRIVER(rpmfc fc)
Panu Matilainen aa664c
+{
Panu Matilainen aa664c
+    return rpmfcHelper(fc, 'P', "psdriver");
Panu Matilainen aa664c
+}
Panu Matilainen aa664c
+
Panu Matilainen aa664c
 static int rpmfcMISC(rpmfc fc)
Panu Matilainen aa664c
 {
Panu Matilainen aa664c
     struct stat st;
Panu Matilainen aa664c
@@ -1224,6 +1230,7 @@ static const struct rpmfcApplyTbl_s cons
Panu Matilainen aa664c
 			 RPMFC_PKGCONFIG|RPMFC_LIBTOOL) },
Panu Matilainen aa664c
     { rpmfcMISC,	RPMFC_FONT|RPMFC_TEXT },
Panu Matilainen aa664c
     { rpmfcSYMLINK,	RPMFC_SYMLINK },
Panu Matilainen aa664c
+    { rpmfcPSDRIVER,	RPMFC_PSDRIVER },
Panu Matilainen aa664c
     { NULL, 0 }
Panu Matilainen aa664c
 };
Panu Matilainen aa664c
 
Panu Matilainen aa664c
@@ -1260,6 +1267,10 @@ rpmRC rpmfcApply(rpmfc fc)
Panu Matilainen aa664c
 		    fc->fcolor->vals[fc->ix] |= RPMFC_PYTHON;
Panu Matilainen aa664c
 	    }
Panu Matilainen aa664c
 	}
Panu Matilainen aa664c
+	/* XXX HACK: get cups driver executables also recognized as psdrivers */
Panu Matilainen aa664c
+	if (strstr(fc->fn[fc->ix], "/usr/lib/cups/driver/")) {
Panu Matilainen aa664c
+	    fc->fcolor->vals[fc->ix] |= RPMFC_PSDRIVER;
Panu Matilainen aa664c
+	}
Panu Matilainen aa664c
 
Panu Matilainen aa664c
 	if (fc->fcolor->vals[fc->ix])
Panu Matilainen aa664c
 	for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
Panu Matilainen aa664c
@@ -1401,6 +1412,11 @@ rpmRC rpmfcClassify(rpmfc fc, ARGV_t arg
Panu Matilainen aa664c
 	    else if (rpmFileHasSuffix(s, ".pc"))
Panu Matilainen aa664c
 		ftype = "pkgconfig file";
Panu Matilainen aa664c
 
Panu Matilainen aa664c
+	    /* XXX Make cups .drv's to appear as PPD's for now */
Panu Matilainen aa664c
+	    else if (rpmFileHasSuffix(s, ".drv") && 
Panu Matilainen aa664c
+		     strstr(s, "/usr/share/cups/drv"))
Panu Matilainen aa664c
+		ftype = "PPD file";
Panu Matilainen aa664c
+
Panu Matilainen aa664c
 	    /* XXX skip all files in /dev/ which are (or should be) %dev dummies. */
Panu Matilainen aa664c
 	    else if (slen >= fc->brlen+sizeof("/dev/") && rstreqn(s+fc->brlen, "/dev/", sizeof("/dev/")-1))
Panu Matilainen aa664c
 		ftype = "";
Panu Matilainen aa664c
diff -up rpm-4.8.0/build/rpmfc.h.postscriptdriver rpm-4.8.0/build/rpmfc.h
Panu Matilainen aa664c
--- rpm-4.8.0/build/rpmfc.h.postscriptdriver	2009-12-09 13:37:25.000000000 +0000
Panu Matilainen aa664c
+++ rpm-4.8.0/build/rpmfc.h	2010-02-04 12:00:09.894684178 +0000
Panu Matilainen aa664c
@@ -31,7 +31,8 @@ enum FCOLOR_e {
Panu Matilainen aa664c
 #define	RPMFC_ELF	(RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)
Panu Matilainen aa664c
 	/* (1 << 3) leaks into package headers, reserved */
Panu Matilainen aa664c
 
Panu Matilainen aa664c
-	/* bits 4-6 unused */
Panu Matilainen aa664c
+	/* bits 4-5 unused */
Panu Matilainen aa664c
+    RPMFC_PSDRIVER		= (1 <<  6),
Panu Matilainen aa664c
     RPMFC_OCAML			= (1 <<  7),
Panu Matilainen aa664c
     RPMFC_PKGCONFIG		= (1 <<  8),
Panu Matilainen aa664c
     RPMFC_LIBTOOL		= (1 <<  9),
Panu Matilainen aa664c
@@ -53,6 +54,7 @@ enum FCOLOR_e {
Panu Matilainen aa664c
     RPMFC_MANPAGE		= (7 << 16),
Panu Matilainen aa664c
     RPMFC_TEXT			= (8 << 16),
Panu Matilainen aa664c
     RPMFC_DOCUMENT		= (9 << 16),
Panu Matilainen aa664c
+    RPMFC_PPD			= (10 << 16),
Panu Matilainen aa664c
 
Panu Matilainen aa664c
     RPMFC_ARCHIVE		= (1 << 20),
Panu Matilainen aa664c
     RPMFC_COMPRESSED		= (1 << 21),
Panu Matilainen aa664c
diff -up rpm-4.8.0/macros.in.postscriptdriver rpm-4.8.0/macros.in
Panu Matilainen aa664c
--- rpm-4.8.0/macros.in.postscriptdriver	2010-02-04 12:00:09.776559914 +0000
Panu Matilainen aa664c
+++ rpm-4.8.0/macros.in	2010-02-04 12:00:09.904559096 +0000
Panu Matilainen aa664c
@@ -504,6 +504,7 @@ print (t)\
Panu Matilainen aa664c
 
Panu Matilainen aa664c
 %__fontconfig_provides	%{_rpmconfigdir}/fontconfig.prov
Panu Matilainen aa664c
 %__desktop_provides	%{_rpmconfigdir}/desktop-file.prov
Panu Matilainen aa664c
+%__psdriver_provides	%{_rpmconfigdir}/postscriptdriver.prov
Panu Matilainen aa664c
 
Panu Matilainen aa664c
 #==============================================================================
Panu Matilainen aa664c
 # ---- Database configuration macros.
Panu Matilainen aa664c
diff -up rpm-4.8.0/scripts/Makefile.am.postscriptdriver rpm-4.8.0/scripts/Makefile.am
Panu Matilainen aa664c
--- rpm-4.8.0/scripts/Makefile.am.postscriptdriver	2009-12-07 14:36:49.000000000 +0000
Panu Matilainen aa664c
+++ rpm-4.8.0/scripts/Makefile.am	2010-02-04 12:00:09.905560182 +0000
Panu Matilainen aa664c
@@ -20,7 +20,8 @@ EXTRA_DIST = \
Panu Matilainen aa664c
 	mono-find-requires mono-find-provides \
Panu Matilainen aa664c
 	ocaml-find-requires.sh ocaml-find-provides.sh \
Panu Matilainen aa664c
 	pkgconfigdeps.sh libtooldeps.sh \
Panu Matilainen aa664c
-	fontconfig.prov desktop-file.prov
Panu Matilainen aa664c
+	fontconfig.prov desktop-file.prov \
Panu Matilainen aa664c
+	postscriptdriver.prov
Panu Matilainen aa664c
 
Panu Matilainen aa664c
 rpmconfig_SCRIPTS = \
Panu Matilainen aa664c
 	brp-compress brp-python-bytecompile brp-java-gcjcompile \
Panu Matilainen aa664c
@@ -34,6 +35,7 @@ rpmconfig_SCRIPTS = \
Panu Matilainen aa664c
 	pkgconfigdeps.sh libtooldeps.sh \
Panu Matilainen aa664c
 	ocaml-find-requires.sh ocaml-find-provides.sh \
Panu Matilainen aa664c
 	fontconfig.prov desktop-file.prov \
Panu Matilainen aa664c
+	postscriptdriver.prov \
Panu Matilainen aa664c
 	rpmdb_loadcvt rpmdiff rpm2cpio.sh tcl.req tgpg 
Panu Matilainen aa664c
 
Panu Matilainen aa664c
 rpmconfig_DATA = \
Panu Matilainen aa664c
diff -up rpm-4.8.0/scripts/Makefile.in.postscriptdriver rpm-4.8.0/scripts/Makefile.in
Panu Matilainen aa664c
--- rpm-4.8.0/scripts/Makefile.in.postscriptdriver	2010-01-08 08:35:16.000000000 +0000
Panu Matilainen aa664c
+++ rpm-4.8.0/scripts/Makefile.in	2010-02-04 12:00:09.906559262 +0000
Panu Matilainen aa664c
@@ -317,7 +317,8 @@ EXTRA_DIST = brp-compress brp-python-byt
Panu Matilainen aa664c
 	find-php-provides find-php-requires mono-find-requires \
Panu Matilainen aa664c
 	mono-find-provides ocaml-find-requires.sh \
Panu Matilainen aa664c
 	ocaml-find-provides.sh pkgconfigdeps.sh libtooldeps.sh \
Panu Matilainen aa664c
-	fontconfig.prov desktop-file.prov macros.perl.in macros.php.in \
Panu Matilainen aa664c
+	fontconfig.prov desktop-file.prov postscriptdriver.prov \
Panu Matilainen aa664c
+	macros.perl.in macros.php.in \
Panu Matilainen aa664c
 	macros.python.in
Panu Matilainen aa664c
 rpmconfig_SCRIPTS = \
Panu Matilainen aa664c
 	brp-compress brp-python-bytecompile brp-java-gcjcompile \
Panu Matilainen aa664c
@@ -331,6 +332,7 @@ rpmconfig_SCRIPTS = \
Panu Matilainen aa664c
 	pkgconfigdeps.sh libtooldeps.sh \
Panu Matilainen aa664c
 	ocaml-find-requires.sh ocaml-find-provides.sh \
Panu Matilainen aa664c
 	fontconfig.prov desktop-file.prov \
Panu Matilainen aa664c
+	postscriptdriver.prov \
Panu Matilainen aa664c
 	rpmdb_loadcvt rpmdiff rpm2cpio.sh tcl.req tgpg 
Panu Matilainen aa664c
 
Panu Matilainen aa664c
 rpmconfig_DATA = rpmdiff.cgi rpm.daily rpm.log rpm.xinetd macros.perl \
Panu Matilainen aa664c
diff -up rpm-4.8.0/scripts/postscriptdriver.prov.postscriptdriver rpm-4.8.0/scripts/postscriptdriver.prov
Panu Matilainen aa664c
--- rpm-4.8.0/scripts/postscriptdriver.prov.postscriptdriver	2010-02-04 12:00:09.907559566 +0000
Panu Matilainen aa664c
+++ rpm-4.8.0/scripts/postscriptdriver.prov	2010-02-04 12:03:57.312559754 +0000
Panu Matilainen aa664c
@@ -0,0 +1,232 @@
Panu Matilainen aa664c
+#!/bin/bash
Panu Matilainen aa664c
+shopt -s execfail
Panu Matilainen aa664c
+exec -a "$0" python -- "$@" <(tail -n +4 -- "$0") || exit 0 # -*- python -*-
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+## Copyright (C) 2009, 2010 Red Hat, Inc.
Panu Matilainen aa664c
+## Author: Tim Waugh <twaugh@redhat.com>
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+## This program is free software; you can redistribute it and/or modify
Panu Matilainen aa664c
+## it under the terms of the GNU General Public License as published by
Panu Matilainen aa664c
+## the Free Software Foundation; either version 2 of the License, or
Panu Matilainen aa664c
+## (at your option) any later version.
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+## This program is distributed in the hope that it will be useful,
Panu Matilainen aa664c
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
Panu Matilainen aa664c
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Panu Matilainen aa664c
+## GNU General Public License for more details.
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+## You should have received a copy of the GNU General Public License
Panu Matilainen aa664c
+## along with this program; if not, write to the Free Software
Panu Matilainen aa664c
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+import sys
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+try:
Panu Matilainen aa664c
+    import cups
Panu Matilainen aa664c
+    CAN_EXAMINE_PPDS=True
Panu Matilainen aa664c
+except:
Panu Matilainen aa664c
+    CAN_EXAMINE_PPDS=False
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+from getopt import getopt
Panu Matilainen aa664c
+import os
Panu Matilainen aa664c
+import posix
Panu Matilainen aa664c
+import re
Panu Matilainen aa664c
+import shlex
Panu Matilainen aa664c
+import signal
Panu Matilainen aa664c
+import stat
Panu Matilainen aa664c
+import subprocess
Panu Matilainen aa664c
+import sys
Panu Matilainen aa664c
+import tempfile
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+class TimedOut(Exception):
Panu Matilainen aa664c
+    def __init__ (self):
Panu Matilainen aa664c
+        Exception.__init__ (self, "Timed out")
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+class DeviceIDs:
Panu Matilainen aa664c
+    def __init__ (self):
Panu Matilainen aa664c
+        self.ids = dict()
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def get_dict (self):
Panu Matilainen aa664c
+        return self.ids
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def get_tags (self):
Panu Matilainen aa664c
+        ret = []
Panu Matilainen aa664c
+        for mfg, mdlset in self.ids.iteritems ():
Panu Matilainen aa664c
+            mfgl = mfg.lower ().replace (" ", "_")
Panu Matilainen aa664c
+            for mdl in mdlset:
Panu Matilainen aa664c
+                mdll = mdl.lower ().replace (" ", "_")
Panu Matilainen aa664c
+                ret.append ("postscriptdriver(%s;%s;)" % (mfgl,
Panu Matilainen aa664c
+                                                          mdll))
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        return ret
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def __add__ (self, other):
Panu Matilainen aa664c
+        if isinstance(other, DeviceIDs):
Panu Matilainen aa664c
+            for omfg, omdlset in other.ids.iteritems ():
Panu Matilainen aa664c
+                try:
Panu Matilainen aa664c
+                    mdlset = self.ids[omfg]
Panu Matilainen aa664c
+                except KeyError:
Panu Matilainen aa664c
+                    mdlset = set()
Panu Matilainen aa664c
+                    self.ids[omfg] = mdlset
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+                mdlset.update (omdlset)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+            return self
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        pieces = other.split (';')
Panu Matilainen aa664c
+        mfg = mdl = None
Panu Matilainen aa664c
+        for piece in pieces:
Panu Matilainen aa664c
+            s = piece.split (":")
Panu Matilainen aa664c
+            if len (s) != 2:
Panu Matilainen aa664c
+                continue
Panu Matilainen aa664c
+            key, value = s
Panu Matilainen aa664c
+            key = key.upper ()
Panu Matilainen aa664c
+            if key in ["MFG", "MANUFACTURER"]:
Panu Matilainen aa664c
+                mfg = value
Panu Matilainen aa664c
+            elif key in ["MDL", "MODEL"]:
Panu Matilainen aa664c
+                mdl = value
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        if mfg and mdl:
Panu Matilainen aa664c
+            try:
Panu Matilainen aa664c
+                mdlset = self.ids[mfg]
Panu Matilainen aa664c
+            except KeyError:
Panu Matilainen aa664c
+                mdlset = set()
Panu Matilainen aa664c
+                self.ids[mfg] = mdlset
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+            mdlset.add (mdl)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        return self
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+class Driver:
Panu Matilainen aa664c
+    def __init__ (self):
Panu Matilainen aa664c
+        self.ids = DeviceIDs()
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def list (self):
Panu Matilainen aa664c
+        return self.ids
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+class PPDDriver(Driver):
Panu Matilainen aa664c
+    def __init__ (self, pathname=None):
Panu Matilainen aa664c
+        Driver.__init__ (self)
Panu Matilainen aa664c
+        self.pathname = pathname
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def list (self):
Panu Matilainen aa664c
+        if self.pathname != None:
Panu Matilainen aa664c
+            self.examine_file (self.pathname)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        return Driver.list (self)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def examine_file (self, path):
Panu Matilainen aa664c
+        try:
Panu Matilainen aa664c
+            ppd = cups.PPD (path)
Panu Matilainen aa664c
+        except RuntimeError, e:
Panu Matilainen aa664c
+            # Not a PPD file.  Perhaps it's a drv file.
Panu Matilainen aa664c
+            drv = DrvDriver (path)
Panu Matilainen aa664c
+            self.ids += drv.list ()
Panu Matilainen aa664c
+            return
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        attr = ppd.findAttr ('1284DeviceID')
Panu Matilainen aa664c
+        if attr:
Panu Matilainen aa664c
+            self.ids += attr.value
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+class DynamicDriver(Driver):
Panu Matilainen aa664c
+    def __init__ (self, driver):
Panu Matilainen aa664c
+        Driver.__init__ (self)
Panu Matilainen aa664c
+        self.driver = driver
Panu Matilainen aa664c
+        signal.signal (signal.SIGALRM, self._alarm)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def _alarm (self, sig, stack):
Panu Matilainen aa664c
+        raise TimedOut
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def list (self):
Panu Matilainen aa664c
+        signal.alarm (60)
Panu Matilainen aa664c
+        p = subprocess.Popen ([self.driver, "list"],
Panu Matilainen aa664c
+                              stdout=subprocess.PIPE,
Panu Matilainen aa664c
+                              stderr=subprocess.PIPE)
Panu Matilainen aa664c
+        try:
Panu Matilainen aa664c
+            (stdout, stderr) = p.communicate ()
Panu Matilainen aa664c
+            signal.alarm (0)
Panu Matilainen aa664c
+        except TimedOut:
Panu Matilainen aa664c
+            posix.kill (p.pid, signal.SIGKILL)
Panu Matilainen aa664c
+            raise
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+	if stderr:
Panu Matilainen aa664c
+		print >> sys.stderr, stderr
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+	ppds = []
Panu Matilainen aa664c
+	lines = stdout.split ('\n')
Panu Matilainen aa664c
+	for line in lines:
Panu Matilainen aa664c
+		l = shlex.split (line)
Panu Matilainen aa664c
+		if len (l) < 5:
Panu Matilainen aa664c
+                    continue
Panu Matilainen aa664c
+                self.ids += l[4]
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        return Driver.list (self)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+class DrvDriver(PPDDriver):
Panu Matilainen aa664c
+    def __init__ (self, pathname):
Panu Matilainen aa664c
+        PPDDriver.__init__ (self)
Panu Matilainen aa664c
+        self.drv = pathname
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def _alarm (self, sig, stack):
Panu Matilainen aa664c
+        raise TimedOut
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def list (self):
Panu Matilainen aa664c
+        tmpdir = os.environ.get ("TMPDIR", "/tmp") + os.path.sep
Panu Matilainen aa664c
+        outputdir = tempfile.mkdtemp (dir=tmpdir)
Panu Matilainen aa664c
+        
Panu Matilainen aa664c
+        argv = [ "ppdc",
Panu Matilainen aa664c
+                 "-d", outputdir,
Panu Matilainen aa664c
+                 "-I", "/usr/share/cups/ppdc",
Panu Matilainen aa664c
+                 self.drv ]
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        signal.alarm (60)
Panu Matilainen aa664c
+        p = subprocess.Popen (argv,
Panu Matilainen aa664c
+                              stdout=subprocess.PIPE,
Panu Matilainen aa664c
+                              stderr=subprocess.PIPE)
Panu Matilainen aa664c
+        try:
Panu Matilainen aa664c
+            (stdout, stderr) = p.communicate ()
Panu Matilainen aa664c
+            signal.alarm (0)
Panu Matilainen aa664c
+        except TimedOut:
Panu Matilainen aa664c
+            posix.kill (p.pid, signal.SIGKILL)
Panu Matilainen aa664c
+            raise
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        os.path.walk (outputdir, self.examine_directory, None)
Panu Matilainen aa664c
+        os.rmdir (outputdir)
Panu Matilainen aa664c
+        return Driver.list (self)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def examine_directory (self, unused, dirname, fnames):
Panu Matilainen aa664c
+        for fname in fnames:
Panu Matilainen aa664c
+            path = dirname + os.path.sep + fname
Panu Matilainen aa664c
+            self.examine_file (path)
Panu Matilainen aa664c
+            os.unlink (path)
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+class TagBuilder:
Panu Matilainen aa664c
+    def __init__ (self, filelist=None):
Panu Matilainen aa664c
+        if filelist == None:
Panu Matilainen aa664c
+            filelist = sys.stdin
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        paths = map (lambda x: x.rstrip (), filelist.readlines ())
Panu Matilainen aa664c
+        self.ids = DeviceIDs ()
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        for path in paths:
Panu Matilainen aa664c
+            if path.find ("/usr/lib/cups/driver/") != -1:
Panu Matilainen aa664c
+                try:
Panu Matilainen aa664c
+                    self.ids += DynamicDriver (path).list ()
Panu Matilainen aa664c
+                except TimedOut:
Panu Matilainen aa664c
+                    pass
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+        if CAN_EXAMINE_PPDS:
Panu Matilainen aa664c
+            for path in paths:
Panu Matilainen aa664c
+                try:
Panu Matilainen aa664c
+                    self.ids += PPDDriver (path).list ()
Panu Matilainen aa664c
+                except TimedOut:
Panu Matilainen aa664c
+                    pass
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+    def get_tags (self):
Panu Matilainen aa664c
+        return self.ids.get_tags ()
Panu Matilainen aa664c
+
Panu Matilainen aa664c
+if __name__ == "__main__":
Panu Matilainen aa664c
+    builder = TagBuilder ()
Panu Matilainen aa664c
+    tags = builder.get_tags ()
Panu Matilainen aa664c
+    for tag in tags:
Panu Matilainen aa664c
+        print tag