]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools: Use absolute import in Workspace
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / MetaFileParser.py
index f35778d18afff744357fbdddd9144dbfcbf1fd6d..fbfc182c8bfff2f142da3a7c7aec80b157fcfdf1 100644 (file)
@@ -16,6 +16,7 @@
 # Import Modules\r
 #\r
 from __future__ import print_function\r
+from __future__ import absolute_import\r
 import Common.LongFilePathOs as os\r
 import re\r
 import time\r
@@ -33,8 +34,8 @@ from Common.Expression import *
 from CommonDataClass.Exceptions import *\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 from collections import defaultdict\r
-from MetaFileTable import MetaFileStorage\r
-from MetaFileCommentParser import CheckInfComment\r
+from .MetaFileTable import MetaFileStorage\r
+from .MetaFileCommentParser import CheckInfComment\r
 \r
 ## RegEx for finding file versions\r
 hexVersionPattern = re.compile(r'0[xX][\da-f-A-F]{5,8}')\r
@@ -369,10 +370,10 @@ class MetaFileParser(object):
                     EdkLogger.error("Parser", FORMAT_INVALID, "Global macro %s is not permitted." % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
             else:\r
                 EdkLogger.error("Parser", FORMAT_INVALID, "%s not defined" % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
-        # Sometimes, we need to make differences between EDK and EDK2 modules \r
+        # Sometimes, we need to make differences between EDK and EDK2 modules\r
         if Name == 'INF_VERSION':\r
             if hexVersionPattern.match(Value):\r
-                self._Version = int(Value, 0)   \r
+                self._Version = int(Value, 0)\r
             elif decVersionPattern.match(Value):\r
                 ValueList = Value.split('.')\r
                 Major = '%04o' % int(ValueList[0], 0)\r
@@ -418,7 +419,7 @@ class MetaFileParser(object):
         Macros.update(self._GetApplicableSectionMacro())\r
         return Macros\r
 \r
-    ## Construct section Macro dict \r
+    ## Construct section Macro dict\r
     def _ConstructSectionMacroDict(self, Name, Value):\r
         ScopeKey = [(Scope[0], Scope[1], Scope[2]) for Scope in self._Scope]\r
         ScopeKey = tuple(ScopeKey)\r
@@ -433,7 +434,7 @@ class MetaFileParser(object):
 \r
         self._SectionsMacroDict[SectionDictKey][Name] = Value\r
 \r
-    ## Get section Macros that are applicable to current line, which may come from other sections \r
+    ## Get section Macros that are applicable to current line, which may come from other sections\r
     ## that share the same name while scope is wider\r
     def _GetApplicableSectionMacro(self):\r
         Macros = {}\r
@@ -1351,7 +1352,7 @@ class DscParser(MetaFileParser):
             try:\r
                 Processer[self._ItemType]()\r
             except EvaluationException as Excpt:\r
-                # \r
+                #\r
                 # Only catch expression evaluation error here. We need to report\r
                 # the precise number of line on which the error occurred\r
                 #\r
@@ -1478,7 +1479,7 @@ class DscParser(MetaFileParser):
                 EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])\r
                 Result = False\r
             except WrnExpression as Excpt:\r
-                # \r
+                #\r
                 # Catch expression evaluation warning here. We need to report\r
                 # the precise number of line and return the evaluation result\r
                 #\r
@@ -1535,7 +1536,7 @@ class DscParser(MetaFileParser):
             __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']\r
             __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE']\r
             #\r
-            # Allow using MACROs comes from [Defines] section to keep compatible. \r
+            # Allow using MACROs comes from [Defines] section to keep compatible.\r
             #\r
             __IncludeMacros.update(self._Macros)\r
 \r