/[pcsclite]/website/matrix.py
ViewVC logotype

Diff of /website/matrix.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3344 by rousseau, Fri Mar 13 09:55:09 2009 UTC revision 3345 by rousseau, Fri Mar 13 15:57:32 2009 UTC
# Line 21  import glob Line 21  import glob
21  import os  import os
22  import ConfigParser  import ConfigParser
23  import pprint  import pprint
24    import templayer
25    import time
26    
27  pp = pprint.PrettyPrinter(indent=4)  pp = pprint.PrettyPrinter(indent=4)
28    
# Line 61  def parse_ini(path, inifile): Line 63  def parse_ini(path, inifile):
63      parse a foobas.ini file to extract all informations      parse a foobas.ini file to extract all informations
64      """      """
65      config = ConfigParser.ConfigParser()      config = ConfigParser.ConfigParser()
66        # do not use the default case insensitive transform for key value
67        config.optionxform = str
68      config.read(inifile)      config.read(inifile)
69      reader_list = config.sections()      reader_list = config.sections()
70    
# Line 93  def check_list(path, reader_list): Line 97  def check_list(path, reader_list):
97      if len(real_list) > 0:      if len(real_list) > 0:
98          raise Exception("readers %s are not listed" % real_list)          raise Exception("readers %s are not listed" % real_list)
99    
100    def get_by_manufacturer(readers):
101        d = {}
102        for r in readers.keys():
103            d.setdefault(readers[r]['iManufacturer'], []).append(r)
104        return d
105    
106  if __name__ == "__main__":  if __name__ == "__main__":
107      path = "../trunk/Drivers/ccid/readers/"      path = "../trunk/Drivers/ccid/readers/"
108    
# Line 104  if __name__ == "__main__": Line 114  if __name__ == "__main__":
114      #pp.pprint(reader_list)      #pp.pprint(reader_list)
115      check_list(path, reader_list)      check_list(path, reader_list)
116    
117      r = "Kobil_EMV_CAP.txt"      # sort the readers by manufacturers
118      #pp.pprint(supported_readers[r].keys())      manufacturer_readers = get_by_manufacturer(supported_readers)
119        manufacturers = list(manufacturer_readers)
120        manufacturers.sort(key=str.lower)
121    
122        r = "Gemalto_PDT.txt"
123        #pp.pprint(supported_readers[r])
124      for k in supported_readers[r].keys():      for k in supported_readers[r].keys():
125          #print k, ":", supported_readers[r][k]          #print k, ":", supported_readers[r][k]
126          pass          pass
127    
128        template = templayer.HTMLTemplate("supported.template")
129        file_writer = template.start_file(file=file("supported.html", "w"))
130        main_layer = file_writer.open(date=time.asctime())
131    
132        # for each manufacturer
133        for m in manufacturers:
134            main_layer.write_layer('manufacturer', manufacturer=m)
135    
136            # for each reader
137            for r in sorted(manufacturer_readers[m]):
138                main_layer.write_layer('reader',
139                        manufacturer=m,
140                        product=supported_readers[r]['iProduct'],
141                        url=supported_readers[r].get('url', ""),
142                        image="img/" + supported_readers[r].get('image',
143                            "no_image.png"))
144        file_writer.close()

Legend:
Removed from v.3344  
changed lines
  Added in v.3345

  ViewVC Help
Powered by ViewVC 1.1.5