~ubuntu-branches/ubuntu/quantal/gutenprint/quantal

« back to all changes in this revision

Viewing changes to debian/local/pyppd/pyppd/ppd.py

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2010-09-16 01:07:03 UTC
  • Revision ID: james.westby@ubuntu.com-20100916010703-09vh0fuxy1cg74q7
Tags: 5.2.6-0ubuntu5
debian/local/pyppd/pyppd/ppd.py, debian/local/pyppd/pyppd/pyppd-ppdfile.in:
Let the compressed PPD archives not contain duplicate PPD URIs, even if the
lines reference the same PPD. Most printer setup tools cannot cope with
duplicate PPD URIs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
                      (language, manufacturer, nickname))
88
88
        ppds = []
89
89
        models = []
 
90
        line = 0
90
91
        if deviceids:
91
 
            ppds = [PPD(filename, language, manufacturer, nickname, deviceid.strip())
92
 
                    for deviceid in deviceids]
93
92
            for deviceid in deviceids:
94
93
                logging.debug('1284DeviceID: "%s".' % deviceid)
 
94
                uri = "%d/%s" % (line, filename)
 
95
                ppds += [PPD(uri, language, manufacturer, nickname, deviceid.strip())]
95
96
                models += re.findall(".*(?:MODEL|MDL):(.*?);.*", deviceid, re.I)
 
97
                line += 1
96
98
 
97
99
        for product in re.findall('\*Product:\s*"\((.+)\)"', ppd_file):
98
100
            product = str.strip(product)
105
107
 
106
108
            logging.debug('Product: "%s"' % product)
107
109
            deviceid = "MFG:%s;MDL:%s;" % (manufacturer, product)
108
 
            ppds += [PPD(filename, language, manufacturer, nickname, deviceid)]
 
110
            uri = "%d/%s" % (line, filename)
 
111
            ppds += [PPD(uri, language, manufacturer, nickname, deviceid)]
 
112
            line += 1
109
113
 
110
114
        return ppds
111
115
    except: