[Pcsclite-cvs-commit] r3419 - /website/matrix.py

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Apr 9 13:52:11 UTC 2009


Author: rousseau
Date: Thu Apr  9 13:52:11 2009
New Revision: 3419

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3419
Log:
generate one big table

Modified:
    website/matrix.py

Modified: website/matrix.py
URL: http://svn.debian.org/wsvn/pcsclite/website/matrix.py?rev=3419&op=diff
==============================================================================
--- website/matrix.py (original)
+++ website/matrix.py Thu Apr  9 13:52:11 2009
@@ -58,18 +58,19 @@
 
     return readers
 
-def parse_ini(path, inifile):
+def parse_ini(path, section):
     """
     parse a foobas.ini file to extract all informations
     """
     config = ConfigParser.ConfigParser()
     # do not use the default case insensitive transform for key value
     config.optionxform = str
-    config.read(inifile)
+    config.read(section + ".ini")
     reader_list = config.sections()
 
     readers = parse_all(path, reader_list)
     for r in readers.keys():
+        readers[r]['section'] = section
         for o in config.options(r):
             if o == 'features':
                 # for the features we use a list
@@ -126,7 +127,7 @@
     file_writer = template.start_file(file=file(section + ".html", "w"))
     main_layer = file_writer.open(date=time.asctime(),
         title=title, comment=comment, section=section)
-    
+
     # for each manufacturer
     for m in manufacturers:
         main_layer.write_layer('manufacturer', manufacturer=m)
@@ -148,7 +149,7 @@
                     url = url,
                     manufacturer = m,
                     product = readers[r]['iProduct'])
-            
+
             features = ", ".join(readers[r].get('features', ""))
             if features:
                 note_layer.write_layer('features', features = features)
@@ -159,12 +160,64 @@
 
     file_writer.close()
 
+def generate_table(readers, index, fields):
+    header = """<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+  <head>
+    <title>Title</title>
+    <link rel="stylesheet" type="text/css" href="default.css">
+  </head>
+  <body>"""
+    footer = """
+    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2404298-2"; urchinTracker(); </script>
+  </body>
+</html>"""
+
+    file = open("idVendor.html", "w")
+    file.write(header)
+
+    file.write('<table border="1" summary="">\n')
+
+    file.write('<tr>')
+    for f in fields:
+        file.write("<th>%s</th>" % f)
+    file.write('</tr>\n')
+
+    for r in readers:
+        if readers[r]['section'] == "unsupported":
+            file.write('<tr bgcolor="#faa">')
+        elif readers[r]['section'] == "shouldwork":
+            file.write('<tr bgcolor="#aff">')
+        else:
+            file.write('<tr>')
+        for f in fields:
+            file.write("<td>%s</td>" % readers[r][f])
+        file.write('</tr>\n')
+
+    file.write('</table>\n')
+
+    file.write(footer)
+    file.close()
+
+def generate_tables(readers):
+    fields = [ 'section', 'iManufacturer', 'iProduct', 'idVendor',
+            'idProduct', 'bNumEndpoints', 'bInterfaceClass', 'bcdCCID',
+            'bMaxSlotIndex', 'bVoltageSupport', 'dwProtocols',
+            'dwDefaultClock', 'dwMaximumClock', 'dwDataRate',
+            'dwMaxDataRate', 'dwMaxIFSD', 'dwSynchProtocols',
+            'dwMechanical', 'dwFeatures', 'dwMaxCCIDMessageLength',
+            'bClassGetResponse', 'bClassEnveloppe', 'wLcdLayout',
+            'bPINSupport', 'bMaxCCIDBusySlots' ]
+
+    generate_table(readers, readers.keys(), fields)
+
 if __name__ == "__main__":
     path = "../trunk/Drivers/ccid/readers/"
 
-    supported_readers = parse_ini(path, "supported.ini")
-    shouldwork_readers = parse_ini(path, "shouldwork.ini")
-    unsupported_readers = parse_ini(path, "unsupported.ini")
+    supported_readers = parse_ini(path, "supported")
+    shouldwork_readers = parse_ini(path, "shouldwork")
+    unsupported_readers = parse_ini(path, "unsupported")
     reader_list = merge(supported_readers.keys(),
             shouldwork_readers.keys(), unsupported_readers.keys())
     #pp.pprint(reader_list)
@@ -173,3 +226,8 @@
     generate_page("supported", "Supported CCID readers/ICCD tokens", "If you are a reader manufacturer and your reader is not listed here then contact me at ludovic.rousseau at free.fr", supported_readers)
     generate_page("shouldwork", "Should work but untested by me", "The CCID readers and ICCD tokens listed bellow should work with the driver but have not be validated by me. I would like to get these readers to perform test and validation and move them in the supported list above. If you are one of the manufacturers, please, contact me at ludovic.rousseau at free.fr.", shouldwork_readers)
     generate_page("unsupported", "Unsupported or partly supported CCID readers", "These readers have problems or serious limitations.", unsupported_readers)
+
+    all_readers = dict(supported_readers)
+    all_readers.update(shouldwork_readers)
+    all_readers.update(unsupported_readers)
+    generate_tables(all_readers)




More information about the Pcsclite-cvs-commit mailing list