]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Parser / InfParserMisc.py
index df32225aff039a7cb6bd3dcee7270404499e6ec7..78908fd98429f1bcd25aac15770e3b74b363e7f8 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
-# This file contained the miscellaneous functions for INF parser \r
+# This file contained the miscellaneous functions for INF parser\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
@@ -59,39 +59,39 @@ gINF_SECTION_DEF = {
        #\r
        # EDK1 section\r
        # TAB_NMAKE.upper()            : MODEL_META_DATA_NMAKE\r
-       # \r
+       #\r
        }\r
 \r
 ## InfExpandMacro\r
 #\r
-# Expand MACRO definition with MACROs defined in [Defines] section and specific section. \r
+# Expand MACRO definition with MACROs defined in [Defines] section and specific section.\r
 # The MACROs defined in specific section has high priority and will be expanded firstly.\r
 #\r
 # @param LineInfo      Contain information of FileName, LineContent, LineNo\r
 # @param GlobalMacros  MACROs defined in INF [Defines] section\r
 # @param SectionMacros MACROs defined in INF specific section\r
-# @param Flag          If the flag set to True, need to skip macros in a quoted string \r
+# @param Flag          If the flag set to True, need to skip macros in a quoted string\r
 #\r
 def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Flag=False):\r
     if GlobalMacros is None:\r
         GlobalMacros = {}\r
     if SectionMacros is None:\r
         SectionMacros = {}\r
-    \r
+\r
     FileName = LineInfo[0]\r
     LineContent = LineInfo[1]\r
     LineNo = LineInfo[2]\r
-    \r
+\r
     # Don't expand macros in comments\r
     if LineContent.strip().startswith("#"):\r
         return Content\r
 \r
     NewLineInfo = (FileName, LineNo, LineContent)\r
-    \r
+\r
     #\r
     # First, replace MARCOs with value defined in specific section\r
     #\r
-    Content = ReplaceMacro (Content, \r
+    Content = ReplaceMacro (Content,\r
                             SectionMacros,\r
                             False,\r
                             (LineContent, LineNo),\r
@@ -100,13 +100,13 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
     #\r
     # Then replace MARCOs with value defined in [Defines] section\r
     #\r
-    Content = ReplaceMacro (Content, \r
+    Content = ReplaceMacro (Content,\r
                             GlobalMacros,\r
                             False,\r
                             (LineContent, LineNo),\r
                             FileName,\r
                             Flag)\r
-    \r
+\r
     MacroUsed = gMACRO_PATTERN.findall(Content)\r
     #\r
     # no macro found in String, stop replacing\r
@@ -122,9 +122,9 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
                 #\r
                 ErrorInInf (ERR_MARCO_DEFINITION_MISS_ERROR,\r
                             LineInfo=NewLineInfo)\r
-        \r
+\r
     return Content\r
-    \r
+\r
 \r
 ## IsBinaryInf\r
 #\r
@@ -135,25 +135,25 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
 def IsBinaryInf(FileLineList):\r
     if not FileLineList:\r
         return False\r
-    \r
+\r
     ReIsSourcesSection = re.compile("^\s*\[Sources.*\]\s.*$", re.IGNORECASE)\r
     ReIsBinarySection = re.compile("^\s*\[Binaries.*\]\s.*$", re.IGNORECASE)\r
     BinarySectionFoundFlag = False\r
-    \r
+\r
     for Line in FileLineList:\r
         if ReIsSourcesSection.match(Line):\r
             return False\r
         if ReIsBinarySection.match(Line):\r
             BinarySectionFoundFlag = True\r
-            \r
+\r
     if BinarySectionFoundFlag:\r
         return True\r
-    \r
+\r
     return False\r
-    \r
-    \r
+\r
+\r
 ## IsLibInstanceInfo\r
-# \r
+#\r
 # Judge whether the string contain the information of ## @LIB_INSTANCES.\r
 #\r
 # @param  String\r
@@ -166,10 +166,10 @@ def IsLibInstanceInfo(String):
         return True\r
     else:\r
         return False\r
-       \r
-            \r
+\r
+\r
 ## IsAsBuildOptionInfo\r
-# \r
+#\r
 # Judge whether the string contain the information of ## @ASBUILD.\r
 #\r
 # @param  String\r
@@ -181,8 +181,8 @@ def IsAsBuildOptionInfo(String):
     if ReIsAsBuildInstance.match(String):\r
         return True\r
     else:\r
-        return False            \r
-        \r
+        return False\r
+\r
 \r
 class InfParserSectionRoot(object):\r
     def __init__(self):\r
@@ -190,19 +190,19 @@ class InfParserSectionRoot(object):
         # Macros defined in [Define] section are file scope global\r
         #\r
         self.FileLocalMacros = {}\r
-        \r
+\r
         #\r
-        # Current Section Header content. \r
+        # Current Section Header content.\r
         #\r
         self.SectionHeaderContent = []\r
 \r
         #\r
-        # Last time Section Header content. \r
+        # Last time Section Header content.\r
         #\r
-        self.LastSectionHeaderContent = []        \r
-         \r
+        self.LastSectionHeaderContent = []\r
+\r
         self.FullPath = ''\r
-        \r
+\r
         self.InfDefSection              = None\r
         self.InfBuildOptionSection      = None\r
         self.InfLibraryClassSection     = None\r
@@ -219,4 +219,4 @@ class InfParserSectionRoot(object):
         self.InfSmmDepexSection         = None\r
         self.InfBinariesSection         = None\r
         self.InfHeader                  = None\r
-        self.InfSpecialCommentSection   = None              \r
+        self.InfSpecialCommentSection   = None\r