]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: remove redundant content in InfSectionParser
authorCarsey, Jaben <jaben.carsey@intel.com>
Fri, 27 Apr 2018 22:32:45 +0000 (06:32 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 4 May 2018 05:03:11 +0000 (13:03 +0800)
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/AutoGen/InfSectionParser.py

index cf4e76159e81daafaf0c59a18499f3f4840a03ef..2cd5a6667a0259e60a787df6bf29d32779735489 100644 (file)
@@ -26,7 +26,6 @@ class InfSectionParser():
         self._ParserInf()\r
     \r
     def _ParserInf(self):\r
-        Filename = self._FilePath\r
         FileLinesList = []\r
         UserExtFind = False\r
         FindEnd = True\r
@@ -35,9 +34,9 @@ class InfSectionParser():
         SectionData = []\r
         \r
         try:\r
-            FileLinesList = open(Filename, "r", 0).readlines()\r
+            FileLinesList = open(self._FilePath, "r", 0).readlines()\r
         except BaseException:\r
-            EdkLogger.error("build", AUTOGEN_ERROR, 'File %s is opened failed.' % Filename)\r
+            EdkLogger.error("build", AUTOGEN_ERROR, 'File %s is opened failed.' % self._FilePath)\r
         \r
         for Index in range(0, len(FileLinesList)):\r
             line = str(FileLinesList[Index]).strip()\r
@@ -49,7 +48,7 @@ class InfSectionParser():
             if UserExtFind and FindEnd == False:\r
                 if line:\r
                     SectionData.append(line)\r
-            if line.lower().startswith(TAB_SECTION_START) and line.lower().endswith(TAB_SECTION_END):\r
+            if line.startswith(TAB_SECTION_START) and line.endswith(TAB_SECTION_END):\r
                 SectionLine = line\r
                 UserExtFind = True\r
                 FindEnd = False\r
@@ -59,7 +58,7 @@ class InfSectionParser():
                 UserExtFind = False\r
                 FindEnd = True\r
                 self._FileSectionDataList.append({SectionLine: SectionData[:]})\r
-                SectionData = []\r
+                del SectionData[:]\r
                 SectionLine = ''\r
     \r
     # Get user extension TianoCore data\r