# 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
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
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
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
\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
#\r
def __init__(self, FilePath, FileType, Arch, Table, Owner= -1, From= -1):\r
# prevent re-initialization\r
- if hasattr(self, "_Table"):\r
+ if hasattr(self, "_Table") and self._Table is Table:\r
return\r
MetaFileParser.__init__(self, FilePath, FileType, Arch, Table, Owner, From)\r
self._Version = 0x00010005 # Only EDK2 dsc file is supported\r
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
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
__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
\r
self._FileWithError = IncludedFile1\r
\r
- IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, False)\r
FromItem = self._Content[self._ContentIndex - 1][0]\r
if self._InSubsection:\r
Owner = self._Content[self._ContentIndex - 1][8]\r
else:\r
Owner = self._Content[self._ContentIndex - 1][0]\r
+ IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, False, FromItem=FromItem)\r
Parser = DscParser(IncludedFile1, self._FileType, self._Arch, IncludedFileTable,\r
Owner=Owner, From=FromItem)\r
\r