1. Wang Dingwei
  2. check_os

Commits

Wang Dingwei  committed af226e6

Using sdrparser2 instead of sdrparser

  • Participants
  • Parent commits 08eac88
  • Branches default
  • Tags 7.1

Comments (0)

Files changed (3)

File check_os.py

View file
         cfg = Config(cfgfile)
         platforms = cfg.platforms()
         for platform in platforms:
-            if res.sdrobj.model() in platform.models:
+            if res.sdrobj.hw_model in platform.models:
                 res.dissection(cfg.keywords(),
                                platform.whitelist,
                                cfg.known_infos(),

File constants.py

View file
 "Constants for other modules."
 
-VERSION = 7.0
+VERSION = 7.1
 SDR_PATH = 'C:\\dell.sdr'
 

File model.py

View file
 "Model for storing SDR data and OS data, and compare between them. "
 
-from wistron import ostype, sdrparser
+from wistron import ostype, sdrparser2
 from constants import SDR_PATH
 
 def lang_matched(os_lang, sdr_lang):
 
     def get_sdr_lang_str(self):
         "Returns a list of MUI languages defined in the SDR."
-        if self.sdrobj.is_mui():
+        if self.sdr_os.is_mui():
             return ''
 
         try:
     def get_sdr_info(self):
         "Read SDR information from SDR_PATH"
         try:
-            self.sdrobj = sdrparser.SDR(SDR_PATH)
+            self.sdrobj = sdrparser2.SDR(SDR_PATH)
+            self.sdr_os = sdrparser2.OSInfo(self.sdrobj)
         except Exception, e:
             self.result = 'NG'
             self.msg.append(e)
             raise
 
         try:
-            self.sdr_type = self.sdrobj.os_type()
-            self.sdr_lang = self.sdrobj.os_lang()
-            self.sdr_langs = self.sdrobj.mui_langs()
-            self.po = self.sdrobj.get_po()
+            self.sdr_type = self.sdr_os.os_type()
+            self.sdr_lang = self.sdr_os.os_lang()
+            self.sdr_langs = self.sdr_os.mui_langs()
             self.sdr_type_str = self.os_string(self.sdr_type)
             self.sdr_lang_str = self.get_sdr_lang_str()
             self.sdr_langs_str = self.get_sdr_langs_str()
     def dissection(self, kwds, wlist, infolist, links):
         "Returns a list of (sdr_line, keyword, sop_link) tuples."
         self.sdr_dissection = []
-        sdr_dissection = self.sdrobj.dissection(kwds, wlist, infolist)
+        sdr_dissection = sdrparser2.dissection(self.sdrobj.lines,
+                         kwds, wlist, infolist)
         for (line, kwd) in sdr_dissection:
             link = ''
             if kwd in ['WLIST', 'KWD', 'QFE', 'NORMAL']:
                 for k, v in links.iteritems():
-                    if self.sdrobj._get_pn(line) in v:
+                    if sdrparser2.get_pn(line) in v:
                         link = k
             self.sdr_dissection.append((line, kwd, link))
 
     def compare(self):
         "Compare between OS and SDR and updates the result."
-        if self.sdrobj.is_mui():
+        if self.sdr_os.is_mui():
             self.msg.append("This is MUI order.")
-            self.sdr_langs = self.sdrobj.mui_langs()
+            self.sdr_langs = self.sdr_os.mui_langs()
             self.result = ('OK'
                            if mui_matched(self.os_langs, self.sdr_langs)
                            else 'NG')