]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools: use predefined constants instead of local strings
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / MetaFileParser.py
index f4c1868483d9fd0c882d252fddd1fa4752d677b6..ae8cf57e389726561dd833e1893eacae1860d4f6 100644 (file)
@@ -219,7 +219,7 @@ class MetaFileParser(object):
         NewRecordList = []\r
         for Record in RecordList:\r
             Arch = Record[3]\r
-            if Arch == 'COMMON' or Arch == FilterArch:\r
+            if Arch == TAB_ARCH_COMMON or Arch == FilterArch:\r
                 NewRecordList.append(Record)\r
         return NewRecordList\r
 \r
@@ -319,7 +319,7 @@ class MetaFileParser(object):
             if len(ItemList) > 1:\r
                 S1 = ItemList[1].upper()\r
             else:\r
-                S1 = 'COMMON'\r
+                S1 = TAB_ARCH_COMMON\r
             ArchList.add(S1)\r
 \r
             # S2 may be Platform or ModuleType\r
@@ -329,15 +329,15 @@ class MetaFileParser(object):
                 else:\r
                     S2 = ItemList[2].upper()\r
             else:\r
-                S2 = 'COMMON'\r
+                S2 = TAB_COMMON\r
             if len(ItemList) > 3:\r
                 S3 = ItemList[3]\r
             else:\r
-                S3 = "COMMON"\r
+                S3 = TAB_COMMON\r
             self._Scope.append([S1, S2, S3])\r
 \r
         # 'COMMON' must not be used with specific ARCHs at the same section\r
-        if 'COMMON' in ArchList and len(ArchList) > 1:\r
+        if TAB_ARCH_COMMON in ArchList and len(ArchList) > 1:\r
             EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",\r
                             File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)\r
         # If the section information is needed later, it should be stored in database\r
@@ -455,12 +455,12 @@ class MetaFileParser(object):
 \r
             for ActiveScope in self._Scope:\r
                 Scope0, Scope1,Scope2 = ActiveScope[0], ActiveScope[1],ActiveScope[2]\r
-                if(Scope0, Scope1,Scope2) not in Scope and (Scope0, "COMMON","COMMON") not in Scope and ("COMMON", Scope1,"COMMON") not in Scope:\r
+                if(Scope0, Scope1,Scope2) not in Scope and (Scope0, TAB_COMMON, TAB_COMMON) not in Scope and (TAB_COMMON, Scope1, TAB_COMMON) not in Scope:\r
                     break\r
             else:\r
                 ComSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)])\r
 \r
-            if ("COMMON", "COMMON","COMMON") in Scope:\r
+            if (TAB_COMMON, TAB_COMMON, TAB_COMMON) in Scope:\r
                 ComComMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)])\r
 \r
         Macros.update(ComComMacroDict)\r
@@ -568,8 +568,8 @@ class InfParser(MetaFileParser):
             if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:\r
                 if not GetHeaderComment:\r
                     for Cmt, LNo in Comments:\r
-                        self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '', '', 'COMMON',\r
-                                    'COMMON', self._Owner[-1], LNo, -1, LNo, -1, 0)\r
+                        self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '', '', TAB_COMMON,\r
+                                    TAB_COMMON, self._Owner[-1], LNo, -1, LNo, -1, 0)\r
                     GetHeaderComment = True\r
                 else:\r
                     TailComments.extend(SectionComments + Comments)\r
@@ -658,8 +658,8 @@ class InfParser(MetaFileParser):
 \r
         # If there are tail comments in INF file, save to database whatever the comments are\r
         for Comment in TailComments:\r
-            self._Store(MODEL_META_DATA_TAIL_COMMENT, Comment[0], '', '', 'COMMON',\r
-                                'COMMON', self._Owner[-1], -1, -1, -1, -1, 0)\r
+            self._Store(MODEL_META_DATA_TAIL_COMMENT, Comment[0], '', '', TAB_COMMON,\r
+                                TAB_COMMON, self._Owner[-1], -1, -1, -1, -1, 0)\r
         self._Done()\r
 \r
     ## Data parser for the format in which there's path\r
@@ -1022,7 +1022,7 @@ class DscParser(MetaFileParser):
                             ExtraData=self._CurrentLine)\r
 \r
         ItemType = self.DataType[DirectiveName]\r
-        Scope = [['COMMON', 'COMMON','COMMON']]\r
+        Scope = [[TAB_COMMON, TAB_COMMON, TAB_COMMON]]\r
         if ItemType == MODEL_META_DATA_INCLUDE:\r
             Scope = self._Scope\r
         if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF:\r
@@ -1832,7 +1832,7 @@ class DecParser(MetaFileParser):
             if len(ItemList) > 1:\r
                 S1 = ItemList[1].upper()\r
             else:\r
-                S1 = 'COMMON'\r
+                S1 = TAB_ARCH_COMMON\r
             ArchList.add(S1)\r
             # S2 may be Platform or ModuleType\r
             if len(ItemList) > 2:\r
@@ -1843,18 +1843,18 @@ class DecParser(MetaFileParser):
                         EdkLogger.error("Parser", FORMAT_INVALID, 'Please use keyword "Private" as section tag modifier.',\r
                                         File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)\r
             else:\r
-                S2 = 'COMMON'\r
+                S2 = TAB_COMMON\r
             PrivateList.add(S2)\r
             if [S1, S2, self.DataType[self._SectionName]] not in self._Scope:\r
                 self._Scope.append([S1, S2, self.DataType[self._SectionName]])\r
 \r
         # 'COMMON' must not be used with specific ARCHs at the same section\r
-        if 'COMMON' in ArchList and len(ArchList) > 1:\r
+        if TAB_ARCH_COMMON in ArchList and len(ArchList) > 1:\r
             EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",\r
                             File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)\r
 \r
         # It is not permissible to mix section tags without the Private attribute with section tags with the Private attribute\r
-        if 'COMMON' in PrivateList and len(PrivateList) > 1:\r
+        if TAB_COMMON in PrivateList and len(PrivateList) > 1:\r
             EdkLogger.error('Parser', FORMAT_INVALID, "Can't mix section tags without the Private attribute with section tags with the Private attribute",\r
                             File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)\r
 \r