]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Parser / InfPackageSectionParser.py
index 8fb2898826e6fff6d71a0339c8fd3e2d9876ec72..0ddd4ef0fc0b21499f204f6da34ed03f71c2a6e3 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
-# This file contained the parser for [Packages] sections in INF file \r
+# This file contained the parser for [Packages] 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,29 +31,29 @@ from Parser.InfParserMisc import InfParserSectionRoot
 class InfPackageSectionParser(InfParserSectionRoot):\r
     ## InfPackageParser\r
     #\r
-    #                       \r
+    #\r
     def InfPackageParser(self, SectionString, InfSectionObject, FileName):\r
         #\r
-        # Macro defined in this section \r
+        # Macro defined in this section\r
         #\r
         SectionMacros = {}\r
         ValueList     = []\r
         PackageList   = []\r
         StillCommentFalg  = False\r
         HeaderComments    = []\r
-        LineComment       = None                  \r
+        LineComment       = None\r
         #\r
         # Parse section content\r
         #\r
         for Line in SectionString:\r
             PkgLineContent = Line[0]\r
-            PkgLineNo      = Line[1]  \r
-            \r
+            PkgLineNo      = Line[1]\r
+\r
             if PkgLineContent.strip() == '':\r
                 continue\r
-            \r
+\r
             #\r
-            # Find Header Comments \r
+            # Find Header Comments\r
             #\r
             if PkgLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):\r
                 #\r
@@ -63,7 +63,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
                     HeaderComments.append(Line)\r
                     continue\r
                 #\r
-                # First time encounter comment \r
+                # First time encounter comment\r
                 #\r
                 else:\r
                     #\r
@@ -75,14 +75,14 @@ class InfPackageSectionParser(InfParserSectionRoot):
                     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
@@ -91,7 +91,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
                 PkgLineContent = PkgLineContent[:PkgLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
                 if LineComment is None:\r
                     LineComment = InfLineCommentObject()\r
-                LineComment.SetTailComments(TailComments)                   \r
+                LineComment.SetTailComments(TailComments)\r
             #\r
             # Find Macro\r
             #\r
@@ -102,39 +102,39 @@ class InfPackageSectionParser(InfParserSectionRoot):
             if Name is not None:\r
                 SectionMacros[Name] = Value\r
                 LineComment = None\r
-                HeaderComments = []                \r
+                HeaderComments = []\r
                 continue\r
 \r
             TokenList = GetSplitValueList(PkgLineContent, DT.TAB_VALUE_SPLIT, 1)\r
             ValueList[0:len(TokenList)] = TokenList\r
-            \r
+\r
             #\r
             # Replace with Local section Macro and [Defines] section Macro.\r
-            #            \r
-            ValueList = [InfExpandMacro(Value, (FileName, PkgLineContent, PkgLineNo), \r
+            #\r
+            ValueList = [InfExpandMacro(Value, (FileName, PkgLineContent, PkgLineNo),\r
                                         self.FileLocalMacros, SectionMacros, True)\r
                                         for Value in ValueList]\r
-            \r
-            PackageList.append((ValueList, LineComment, \r
+\r
+            PackageList.append((ValueList, LineComment,\r
                                 (PkgLineContent, PkgLineNo, FileName)))\r
             ValueList = []\r
             LineComment = None\r
             TailComments = ''\r
-            HeaderComments = []            \r
+            HeaderComments = []\r
             continue\r
 \r
         #\r
         # Current section archs\r
-        #    \r
+        #\r
         ArchList = []\r
         for Item in self.LastSectionHeaderContent:\r
             if Item[1] not in ArchList:\r
-                ArchList.append(Item[1])  \r
-        \r
+                ArchList.append(Item[1])\r
+\r
         if not InfSectionObject.SetPackages(PackageList, Arch = ArchList):\r
-            Logger.Error('InfParser', \r
-                         FORMAT_INVALID, \r
+            Logger.Error('InfParser',\r
+                         FORMAT_INVALID,\r
                          ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR\\r
                          %("[Packages]"),\r
                          File=FileName,\r
-                         Line=Item[3])         
\ No newline at end of file
+                         Line=Item[3])\r