]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Library/Parsing.py
BaseTools: Use absolute import in UPT
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Library / Parsing.py
index 22030e7587c1ae51612640d8cb9f75a46d43cee6..81729d6cdbf7b3a2c43e6bfaf6072117e128296d 100644 (file)
@@ -1,12 +1,12 @@
 ## @file\r
-# This file is used to define common parsing related functions used in parsing \r
+# This file is used to define common parsing related functions used in parsing\r
 # INF/DEC/DSC process\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
@@ -16,6 +16,7 @@
 '''\r
 Parsing\r
 '''\r
+from __future__ import absolute_import\r
 \r
 ##\r
 # Import Modules\r
@@ -42,7 +43,7 @@ from Logger import StringTable as ST
 import Logger.Log as Logger\r
 \r
 from Parser.DecParser import Dec\r
-import GlobalData\r
+from . import GlobalData\r
 \r
 gPKG_INFO_DICT = {}\r
 \r
@@ -74,7 +75,7 @@ def GetBuildOption(String, File, LineNo= -1):
 # Get Library of Dsc as <LibraryClassKeyWord>|<LibraryInstance>\r
 #\r
 # @param Item:           String as <LibraryClassKeyWord>|<LibraryInstance>\r
-# @param ContainerFile:  The file which describes the library class, used for \r
+# @param ContainerFile:  The file which describes the library class, used for\r
 #                        error report\r
 #\r
 def GetLibraryClass(Item, ContainerFile, WorkspaceDir, LineNo= -1):\r
@@ -99,7 +100,7 @@ def GetLibraryClass(Item, ContainerFile, WorkspaceDir, LineNo= -1):
 # [|<TokenSpaceGuidCName>.<PcdCName>]\r
 #\r
 # @param Item:           String as <LibraryClassKeyWord>|<LibraryInstance>\r
-# @param ContainerFile:  The file which describes the library class, used for \r
+# @param ContainerFile:  The file which describes the library class, used for\r
 #                        error report\r
 #\r
 def GetLibraryClassOfInf(Item, ContainerFile, WorkspaceDir, LineNo= -1):\r
@@ -148,7 +149,7 @@ def CheckPcdTokenInfo(TokenInfoString, Section, File, LineNo= -1):
 #\r
 # @param Item:           String as <PcdTokenSpaceGuidCName>.<TokenCName>|\r
 #                        <Value>[|<Type>|<MaximumDatumSize>]\r
-# @param ContainerFile:  The file which describes the pcd, used for error \r
+# @param ContainerFile:  The file which describes the pcd, used for error\r
 #                        report\r
 \r
 #\r
@@ -176,7 +177,7 @@ def GetPcd(Item, Type, ContainerFile, LineNo= -1):
 #\r
 # @param Item:           String as <PcdTokenSpaceGuidCName>\r
 #                        .<TokenCName>|TRUE/FALSE\r
-# @param ContainerFile:  The file which describes the pcd, used for error \r
+# @param ContainerFile:  The file which describes the pcd, used for error\r
 #                        report\r
 #\r
 def GetFeatureFlagPcd(Item, Type, ContainerFile, LineNo= -1):\r
@@ -200,7 +201,7 @@ def GetFeatureFlagPcd(Item, Type, ContainerFile, LineNo= -1):
 #\r
 # @param Item:           String as <PcdTokenSpaceGuidCName>.<TokenCName>|\r
 #                        TRUE/FALSE\r
-# @param ContainerFile:  The file which describes the pcd, used for error \r
+# @param ContainerFile:  The file which describes the pcd, used for error\r
 #                        report\r
 #\r
 def GetDynamicDefaultPcd(Item, Type, ContainerFile, LineNo= -1):\r
@@ -226,7 +227,7 @@ def GetDynamicDefaultPcd(Item, Type, ContainerFile, LineNo= -1):
 #\r
 # @param Item:           String as <PcdTokenSpaceGuidCName>.<TokenCName>|\r
 #                        TRUE/FALSE\r
-# @param ContainerFile:  The file which describes the pcd, used for error \r
+# @param ContainerFile:  The file which describes the pcd, used for error\r
 #                        report\r
 #\r
 def GetDynamicHiiPcd(Item, Type, ContainerFile, LineNo= -1):\r
@@ -253,7 +254,7 @@ def GetDynamicHiiPcd(Item, Type, ContainerFile, LineNo= -1):
 #\r
 # @param Item:           String as <PcdTokenSpaceGuidCName>.<TokenCName>\r
 #                        |TRUE/FALSE\r
-# @param ContainerFile:  The file which describes the pcd, used for error \r
+# @param ContainerFile:  The file which describes the pcd, used for error\r
 #                        report\r
 #\r
 def GetDynamicVpdPcd(Item, Type, ContainerFile, LineNo= -1):\r
@@ -273,7 +274,7 @@ def GetDynamicVpdPcd(Item, Type, ContainerFile, LineNo= -1):
 ## GetComponent\r
 #\r
 # Parse block of the components defined in dsc file\r
-# Set KeyValues as [ ['component name', [lib1, lib2, lib3], \r
+# Set KeyValues as [ ['component name', [lib1, lib2, lib3],\r
 # [bo1, bo2, bo3], [pcd1, pcd2, pcd3]], ...]\r
 #\r
 # @param Lines:             The content to be parsed\r
@@ -408,7 +409,7 @@ def GetExec(String):
 ## GetComponents\r
 #\r
 # Parse block of the components defined in dsc file\r
-# Set KeyValues as [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3], \r
+# Set KeyValues as [ ['component name', [lib1, lib2, lib3], [bo1, bo2, bo3],\r
 # [pcd1, pcd2, pcd3]], ...]\r
 #\r
 # @param Lines:             The content to be parsed\r
@@ -531,7 +532,7 @@ def GetComponents(Lines, KeyValues, CommentCharacter):
 #\r
 # @param Item:           String as <Filename>[|<Family>[|<TagName>[|<ToolCode>\r
 #                        [|<PcdFeatureFlag>]]]]\r
-# @param ContainerFile:  The file which describes the library class, used \r
+# @param ContainerFile:  The file which describes the library class, used\r
 #                        for error report\r
 #\r
 def GetSource(Item, ContainerFile, FileRelativePath, LineNo= -1):\r
@@ -556,7 +557,7 @@ def GetSource(Item, ContainerFile, FileRelativePath, LineNo= -1):
 #\r
 # @param Item:           String as <Filename>[|<Family>[|<TagName>\r
 #                        [|<ToolCode>[|<PcdFeatureFlag>]]]]\r
-# @param ContainerFile:  The file which describes the library class, \r
+# @param ContainerFile:  The file which describes the library class,\r
 #                        used for error report\r
 #\r
 def GetBinary(Item, ContainerFile, LineNo= -1):\r
@@ -580,7 +581,7 @@ def GetBinary(Item, ContainerFile, LineNo= -1):
 #\r
 # @param Item:           String as <GuidCName>[|<PcdFeatureFlag>]\r
 # @param Type:           Type of parsing string\r
-# @param ContainerFile:  The file which describes the library class, \r
+# @param ContainerFile:  The file which describes the library class,\r
 #                        used for error report\r
 #\r
 def GetGuidsProtocolsPpisOfInf(Item):\r
@@ -594,7 +595,7 @@ def GetGuidsProtocolsPpisOfInf(Item):
 #\r
 # @param Item:           String as <GuidCName>=<GuidValue>\r
 # @param Type:           Type of parsing string\r
-# @param ContainerFile:  The file which describes the library class, \r
+# @param ContainerFile:  The file which describes the library class,\r
 # used for error report\r
 #\r
 def GetGuidsProtocolsPpisOfDec(Item, Type, ContainerFile, LineNo= -1):\r
@@ -625,7 +626,7 @@ def GetGuidsProtocolsPpisOfDec(Item, Type, ContainerFile, LineNo= -1):
 #\r
 # @param Item:           String as <PackagePath>[|<PcdFeatureFlag>]\r
 # @param Type:           Type of parsing string\r
-# @param ContainerFile:  The file which describes the library class, \r
+# @param ContainerFile:  The file which describes the library class,\r
 #                        used for error report\r
 #\r
 def GetPackage(Item, ContainerFile, FileRelativePath, LineNo= -1):\r
@@ -936,7 +937,7 @@ def MacroParser(Line, FileName, SectionType, FileLocalMacros):
     # <Value>           ::=  {<NumVal>} {<Boolean>} {<AsciiString>} {<GUID>}\r
     #                        {<CString>} {<UnicodeString>} {<CArray>}\r
     #\r
-    # The definition of <NumVal>, <PATH>, <Boolean>, <GUID>, <CString>, \r
+    # The definition of <NumVal>, <PATH>, <Boolean>, <GUID>, <CString>,\r
     # <UnicodeString>, <CArray> are subset of <AsciiString>.\r
     #\r
     ReIsValidMacroValue = re.compile(r"^[\x20-\x7e]*$", re.DOTALL)\r
@@ -950,15 +951,15 @@ def MacroParser(Line, FileName, SectionType, FileLocalMacros):
 \r
     return Name, Value\r
 \r
-## GenSection \r
+## GenSection\r
 #\r
 # generate section contents\r
 #\r
-# @param  SectionName:  indicate the name of the section, details refer to \r
+# @param  SectionName:  indicate the name of the section, details refer to\r
 #                       INF, DEC specs\r
-# @param  SectionDict:  section statement dict, key is SectionAttrs(arch, \r
-#                       moduletype or platform may exist as needed) list \r
-#                       seperated by space, \r
+# @param  SectionDict:  section statement dict, key is SectionAttrs(arch,\r
+#                       moduletype or platform may exist as needed) list\r
+#                       seperated by space,\r
 #                       value is statement\r
 #\r
 def GenSection(SectionName, SectionDict, SplitArch=True, NeedBlankLine=False):\r
@@ -1004,10 +1005,10 @@ def GenSection(SectionName, SectionDict, SplitArch=True, NeedBlankLine=False):
     return Content\r
 \r
 ## ConvertArchForInstall\r
-# if Arch.upper() is in "IA32", "X64", "IPF", and "EBC", it must be upper case.  "common" must be lower case.  \r
+# if Arch.upper() is in "IA32", "X64", "IPF", and "EBC", it must be upper case.  "common" must be lower case.\r
 # Anything else, the case must be preserved\r
 #\r
-# @param Arch: the arch string that need to be converted, it should be stripped before pass in \r
+# @param Arch: the arch string that need to be converted, it should be stripped before pass in\r
 # @return: the arch string that get converted\r
 #\r
 def ConvertArchForInstall(Arch):\r