]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Parser / InfPcdSectionParser.py
index 13535a3738eabf9f115fbb724f69b2d954385c64..b741616c3da66945743f1f1a54733ce2c623a575 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
-# This file contained the parser for [Pcds] sections in INF file \r
+# This file contained the parser for [Pcds] sections in INF file\r
 #\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,49 +31,49 @@ from Parser.InfParserMisc import InfParserSectionRoot
 \r
 class InfPcdSectionParser(InfParserSectionRoot):\r
     ## Section PCD related parser\r
-    # \r
+    #\r
     # For 5 types of PCD list below, all use this function.\r
     # 'FixedPcd', 'FeaturePcd', 'PatchPcd', 'Pcd', 'PcdEx'\r
     #\r
-    # This is a INF independent parser, the validation in this parser only \r
+    # This is a INF independent parser, the validation in this parser only\r
     # cover\r
     # INF spec scope, will not cross DEC/DSC to check pcd value\r
     #\r
     def InfPcdParser(self, SectionString, InfSectionObject, FileName):\r
         KeysList = []\r
         PcdList   = []\r
-        CommentsList = []          \r
-        ValueList = [] \r
+        CommentsList = []\r
+        ValueList = []\r
         #\r
         # Current section archs\r
-        #          \r
+        #\r
         LineIndex = -1\r
         for Item in self.LastSectionHeaderContent:\r
             if (Item[0], Item[1], Item[3]) not in KeysList:\r
                 KeysList.append((Item[0], Item[1], Item[3]))\r
                 LineIndex = Item[3]\r
-            \r
+\r
             if (Item[0].upper() == DT.TAB_INF_FIXED_PCD.upper() or \\r
                 Item[0].upper() == DT.TAB_INF_FEATURE_PCD.upper() or \\r
                 Item[0].upper() == DT.TAB_INF_PCD.upper()) and GlobalData.gIS_BINARY_INF:\r
                 Logger.Error('InfParser', FORMAT_INVALID, ST.ERR_ASBUILD_PCD_SECTION_TYPE%("\"" + Item[0] + "\""),\r
-                             File=FileName, Line=LineIndex)                    \r
-                            \r
+                             File=FileName, Line=LineIndex)\r
+\r
         #\r
         # For Common INF file\r
         #\r
-        if not GlobalData.gIS_BINARY_INF:   \r
+        if not GlobalData.gIS_BINARY_INF:\r
             #\r
-            # Macro defined in this section \r
+            # Macro defined in this section\r
             #\r
-            SectionMacros = {}        \r
+            SectionMacros = {}\r
             for Line in SectionString:\r
                 PcdLineContent = Line[0]\r
                 PcdLineNo      = Line[1]\r
                 if PcdLineContent.strip() == '':\r
                     CommentsList = []\r
-                    continue                   \r
-                    \r
+                    continue\r
+\r
                 if PcdLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):\r
                     CommentsList.append(Line)\r
                     continue\r
@@ -83,10 +83,10 @@ class InfPcdSectionParser(InfParserSectionRoot):
                     #\r
                     if PcdLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:\r
                         CommentsList.append((\r
-                                PcdLineContent[PcdLineContent.find(DT.TAB_COMMENT_SPLIT):], \r
+                                PcdLineContent[PcdLineContent.find(DT.TAB_COMMENT_SPLIT):],\r
                                 PcdLineNo))\r
-                        PcdLineContent = PcdLineContent[:PcdLineContent.find(DT.TAB_COMMENT_SPLIT)] \r
-                \r
+                        PcdLineContent = PcdLineContent[:PcdLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
+\r
                 if PcdLineContent != '':\r
                     #\r
                     # Find Macro\r
@@ -100,23 +100,23 @@ class InfPcdSectionParser(InfParserSectionRoot):
                         ValueList = []\r
                         CommentsList = []\r
                         continue\r
-                    \r
+\r
                     PcdEntryReturn = SplitPcdEntry(PcdLineContent)\r
-                    \r
+\r
                     if not PcdEntryReturn[1]:\r
-                        TokenList = ['']               \r
+                        TokenList = ['']\r
                     else:\r
                         TokenList = PcdEntryReturn[0]\r
-                          \r
+\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, PcdLineContent, PcdLineNo), \r
+                    #\r
+                    ValueList = [InfExpandMacro(Value, (FileName, PcdLineContent, PcdLineNo),\r
                                                 self.FileLocalMacros, SectionMacros, True)\r
                                 for Value in ValueList]\r
-                                   \r
+\r
                 if len(ValueList) >= 1:\r
                     PcdList.append((ValueList, CommentsList, (PcdLineContent, PcdLineNo, FileName)))\r
                     ValueList = []\r
@@ -129,11 +129,11 @@ class InfPcdSectionParser(InfParserSectionRoot):
             for Line in SectionString:\r
                 LineContent = Line[0].strip()\r
                 LineNo      = Line[1]\r
-                \r
+\r
                 if LineContent == '':\r
                     CommentsList = []\r
                     continue\r
-                \r
+\r
                 if LineContent.startswith(DT.TAB_COMMENT_SPLIT):\r
                     CommentsList.append(LineContent)\r
                     continue\r
@@ -144,7 +144,7 @@ class InfPcdSectionParser(InfParserSectionRoot):
                 if  CommentIndex > -1:\r
                     CommentsList.append(LineContent[CommentIndex+1:])\r
                     LineContent = LineContent[:CommentIndex]\r
-                \r
+\r
                 TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT)\r
                 #\r
                 # PatchablePcd\r
@@ -152,33 +152,33 @@ class InfPcdSectionParser(InfParserSectionRoot):
                 #\r
                 if KeysList[0][0].upper() == DT.TAB_INF_PATCH_PCD.upper():\r
                     if len(TokenList) != 3:\r
-                        Logger.Error('InfParser', \r
-                                     FORMAT_INVALID, \r
+                        Logger.Error('InfParser',\r
+                                     FORMAT_INVALID,\r
                                      ST.ERR_ASBUILD_PATCHPCD_FORMAT_INVALID,\r
                                      File=FileName,\r
                                      Line=LineNo,\r
                                      ExtraData=LineContent)\r
-                #                    \r
+                #\r
                 elif KeysList[0][0].upper() == DT.TAB_INF_PCD_EX.upper():\r
                     if len(TokenList) != 1:\r
-                        Logger.Error('InfParser', \r
-                                     FORMAT_INVALID, \r
+                        Logger.Error('InfParser',\r
+                                     FORMAT_INVALID,\r
                                      ST.ERR_ASBUILD_PCDEX_FORMAT_INVALID,\r
                                      File=FileName,\r
                                      Line=LineNo,\r
                                      ExtraData=LineContent)\r
                 ValueList[0:len(TokenList)] = TokenList\r
-                if len(ValueList) >= 1:                \r
-                    PcdList.append((ValueList, CommentsList, (LineContent, LineNo, FileName)))                  \r
+                if len(ValueList) >= 1:\r
+                    PcdList.append((ValueList, CommentsList, (LineContent, LineNo, FileName)))\r
                     ValueList = []\r
                     CommentsList = []\r
-                continue          \r
-                    \r
-        if not InfSectionObject.SetPcds(PcdList, KeysList = KeysList, \r
+                continue\r
+\r
+        if not InfSectionObject.SetPcds(PcdList, KeysList = KeysList,\r
                                         PackageInfo = self.InfPackageSection.GetPackages()):\r
-            Logger.Error('InfParser', \r
-                         FORMAT_INVALID, \r
+            Logger.Error('InfParser',\r
+                         FORMAT_INVALID,\r
                          ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[PCD]"),\r
                          File=FileName,\r
-                         Line=LineIndex)            \r
-    
\ No newline at end of file
+                         Line=LineIndex)\r
+\r