From 75be0201cb6ac504ea7a2159a66c31ad69a5d858 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 20 Jan 2009 03:41:45 +0000 Subject: We can now generate a better hardware data dable fom the database. --- gpscap.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'gpscap.py') diff --git a/gpscap.py b/gpscap.py index 7cb44812..9ebe8db8 100644 --- a/gpscap.py +++ b/gpscap.py @@ -37,11 +37,14 @@ class GPSDictionary(ConfigParser.RawConfigParser): elif self.get(section, "type") not in ("engine", "vendor", "device"): raise ConfigParser.Error("%s has invalid type" % section) # Sanity check: All devices must point at a vendor object. - # Side effect: build the list of vendors. + # Side effect: build the lists of vendors and devices. self.vendors = [] + self.devices = [] for section in self.sections(): if self.get(section, "type") == "vendor": self.vendors.append(section) + if self.get(section, "type") == "device": + self.devices.append(section) self.vendors.sort() for section in self.sections(): if self.get(section, "type") == "device": @@ -49,5 +52,52 @@ class GPSDictionary(ConfigParser.RawConfigParser): raise ConfigParser.Error("%s has no vendor" % section) if self.get(section, "vendor") not in self.vendors: raise ConfigParser.Error("%s has invalid vendor" % section) + + def HTMLDump(self, ofp): + thead = """ + + + + + + + + + +""" + vhead = "\n" + ofp.write(thead) + for vendor in self.vendors: + ofp.write(vhead % (self.get(vendor, "vendor_site"), vendor)) + relevant = [] + for dev in self.devices: + if self.get(dev, "vendor") == vendor: + relevant.append(dev) + relevant.sort() + for dev in relevant: + ofp.write("\n") + ofp.write("\n" % dev) + ofp.write("\n" % self.get(dev, "packaging")) + ofp.write("\n" % self.get(dev, "engine")) + ofp.write("\n" % self.get(dev, "interfaces")) + tested = "" + if self.has_option(dev, "broken"): + tested = "Broken" + elif self.get(dev, "tested") == "regression": + tested = "*" + else: + tested = self.get(dev, "tested") + ofp.write("\n" % tested) + nmea = " " + if self.has_option(dev, "nmea"): + nmea = self.get(dev, "nmea") + ofp.write("\n" % nmea) + ofp.write("\n" % self.get(dev, "notes")) + ofp.write("\n") + ofp.write("
NamePackagingEngineInterfaceTested withNMEA versionNotes
%s
%s%s%s%s%s%s%s
\n") + + if __name__ == "__main__": + import sys d = GPSDictionary() + d.HTMLDump(sys.stdout) -- cgit v1.2.1