]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Parser / InfSourceSectionParser.py
index 645c2c341460a9a54193db20e54de0ceef654a26..6b94394508443886302309f1da20360fad5a065c 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
-# This file contained the parser for [Sources] sections in INF file \r
+# This file contained the parser for [Sources] sections in INF file\r
 #\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
 # http://opensource.org/licenses/bsd-license.php\r
 #\r
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
@@ -31,7 +31,7 @@ from Parser.InfParserMisc import InfParserSectionRoot
 class InfSourceSectionParser(InfParserSectionRoot):\r
     ## InfSourceParser\r
     #\r
-    #          \r
+    #\r
     def InfSourceParser(self, SectionString, InfSectionObject, FileName):\r
         SectionMacros = {}\r
         ValueList     = []\r
@@ -43,12 +43,12 @@ class InfSourceSectionParser(InfParserSectionRoot):
         for Line in SectionString:\r
             SrcLineContent = Line[0]\r
             SrcLineNo      = Line[1]\r
-            \r
+\r
             if SrcLineContent.strip() == '':\r
                 continue\r
-            \r
+\r
             #\r
-            # Found Header Comments \r
+            # Found Header Comments\r
             #\r
             if SrcLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):\r
                 #\r
@@ -59,7 +59,7 @@ class InfSourceSectionParser(InfParserSectionRoot):
                     SectionContent += SrcLineContent + DT.END_OF_LINE\r
                     continue\r
                 #\r
-                # First time encounter comment \r
+                # First time encounter comment\r
                 #\r
                 else:\r
                     #\r
@@ -68,18 +68,18 @@ class InfSourceSectionParser(InfParserSectionRoot):
                     HeaderComments = []\r
                     HeaderComments.append(Line)\r
                     StillCommentFalg = True\r
-                    SectionContent += SrcLineContent + DT.END_OF_LINE \r
+                    SectionContent += SrcLineContent + DT.END_OF_LINE\r
                     continue\r
             else:\r
                 StillCommentFalg = False\r
-                          \r
+\r
             if len(HeaderComments) >= 1:\r
                 LineComment = InfLineCommentObject()\r
                 LineCommentContent = ''\r
                 for Item in HeaderComments:\r
                     LineCommentContent += Item[0] + DT.END_OF_LINE\r
                 LineComment.SetHeaderComments(LineCommentContent)\r
-            \r
+\r
             #\r
             # Find Tail comment.\r
             #\r
@@ -89,11 +89,11 @@ class InfSourceSectionParser(InfParserSectionRoot):
                 if LineComment is None:\r
                     LineComment = InfLineCommentObject()\r
                 LineComment.SetTailComments(TailComments)\r
-                               \r
+\r
             #\r
             # Find Macro\r
             #\r
-            Name, Value = MacroParser((SrcLineContent, SrcLineNo), \r
+            Name, Value = MacroParser((SrcLineContent, SrcLineNo),\r
                                       FileName,\r
                                       DT.MODEL_EFI_SOURCE_FILE,\r
                                       self.FileLocalMacros)\r
@@ -102,44 +102,44 @@ class InfSourceSectionParser(InfParserSectionRoot):
                 LineComment = None\r
                 HeaderComments = []\r
                 continue\r
-            \r
+\r
             #\r
             # Replace with Local section Macro and [Defines] section Macro.\r
-            #            \r
-            SrcLineContent = InfExpandMacro(SrcLineContent, \r
-                                         (FileName, SrcLineContent, SrcLineNo), \r
-                                         self.FileLocalMacros, \r
+            #\r
+            SrcLineContent = InfExpandMacro(SrcLineContent,\r
+                                         (FileName, SrcLineContent, SrcLineNo),\r
+                                         self.FileLocalMacros,\r
                                          SectionMacros)\r
 \r
             TokenList = GetSplitValueList(SrcLineContent, DT.TAB_VALUE_SPLIT, 4)\r
             ValueList[0:len(TokenList)] = TokenList\r
-          \r
+\r
             #\r
             # Store section content string after MACRO replaced.\r
             #\r
-            SectionContent += SrcLineContent + DT.END_OF_LINE \r
-            \r
-            SourceList.append((ValueList, LineComment, \r
+            SectionContent += SrcLineContent + DT.END_OF_LINE\r
+\r
+            SourceList.append((ValueList, LineComment,\r
                                (SrcLineContent, SrcLineNo, FileName)))\r
             ValueList = []\r
             LineComment = None\r
             TailComments = ''\r
             HeaderComments = []\r
             continue\r
-        \r
+\r
         #\r
         # Current section archs\r
         #\r
         ArchList = []\r
         for Item in self.LastSectionHeaderContent:\r
             if Item[1] not in ArchList:\r
-                ArchList.append(Item[1])  \r
+                ArchList.append(Item[1])\r
                 InfSectionObject.SetSupArchList(Item[1])\r
-                \r
-        InfSectionObject.SetAllContent(SectionContent)             \r
+\r
+        InfSectionObject.SetAllContent(SectionContent)\r
         if not InfSectionObject.SetSources(SourceList, Arch = ArchList):\r
-            Logger.Error('InfParser', \r
+            Logger.Error('InfParser',\r
                          FORMAT_INVALID,\r
                          ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Sources]"),\r
-                         File=FileName, \r
-                         Line=Item[3])            
\ No newline at end of file
+                         File=FileName,\r
+                         Line=Item[3])\r