summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Workspace
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-11 06:26:52 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-10-11 06:26:52 +0000
commit08dd311f5dc735c595d39faf2e6f7e2810bb79a9 (patch)
treeeb384e3139391ac0dabc69e40b4605d9d7315342 /BaseTools/Source/Python/Workspace
parentd69bf66dc1ad8143260dcb8e095d7ed91b211dd7 (diff)
downloadedk2-platforms-08dd311f5dc735c595d39faf2e6f7e2810bb79a9.tar.xz
Sync EDKII BaseTools to BaseTools project r2065.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10915 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py18
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py37
2 files changed, 25 insertions, 30 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index fb66e41fb5..3c7d7fdf6a 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -474,11 +474,11 @@ class InfParser(MetaFileParser):
def _DefineParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
self._ValueList[0:len(TokenList)] = TokenList
- self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
if self._ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-
+ self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
+
## [nmake] section parser (R8.x style only)
def _NmakeParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
@@ -655,6 +655,11 @@ class DscParser(MetaFileParser):
continue
# file private macros
elif Line.upper().startswith('DEFINE '):
+ if self._Enabled < 0:
+ # Do not parse the macro and add it to self._Macros dictionary if directives
+ # statement is evaluated to false.
+ continue
+
(Name, Value) = self._MacroParser()
# Make the defined macro in DSC [Defines] section also
# available for FDF file.
@@ -676,6 +681,11 @@ class DscParser(MetaFileParser):
)
continue
elif Line.upper().startswith('EDK_GLOBAL '):
+ if self._Enabled < 0:
+ # Do not parse the macro and add it to self._Macros dictionary
+ # if previous directives statement is evaluated to false.
+ continue
+
(Name, Value) = self._MacroParser()
for Arch, ModuleType in self._Scope:
self._LastItem = self._Store(
@@ -802,8 +812,8 @@ class DscParser(MetaFileParser):
if not self._SectionName in self._IncludeAllowedSection:
EdkLogger.error("Parser", FORMAT_INVALID, File=self.MetaFile, Line=self._LineIndex+1,
ExtraData="'!include' is not allowed under section [%s]" % self._SectionName)
- # the included file must be relative to the parsing file
- IncludedFile = os.path.join(self._FileDir, NormPath(self._ValueList[1], self._Macros))
+ # the included file must be relative to workspace
+ IncludedFile = os.path.join(os.environ["WORKSPACE"], NormPath(self._ValueList[1], self._Macros))
Parser = DscParser(IncludedFile, self._FileType, self._Table, self._Macros, From=self._LastItem)
# set the parser status with current status
Parser._SectionName = self._SectionName
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index dad6ecd49a..9d53fa8e68 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -141,7 +141,6 @@ class DscBuildData(PlatformBuildClassObject):
self._BuildOptions = None
self._LoadFixAddress = None
self._VpdToolGuid = None
- self._VpdFileName = None
## Get architecture
def _GetArch(self):
@@ -204,9 +203,7 @@ class DscBuildData(PlatformBuildClassObject):
uuid.UUID(Record[1])
except:
EdkLogger.error("build", FORMAT_INVALID, "Invalid GUID format for VPD_TOOL_GUID", File=self.MetaFile)
- self._VpdToolGuid = Record[1]
- elif Name == TAB_DSC_DEFINES_VPD_FILENAME:
- self._VpdFileName = Record[1]
+ self._VpdToolGuid = Record[1]
# set _Header to non-None in order to avoid database re-querying
self._Header = 'DUMMY'
@@ -350,16 +347,7 @@ class DscBuildData(PlatformBuildClassObject):
if self._VpdToolGuid == None:
self._VpdToolGuid = ''
return self._VpdToolGuid
-
- ## Retrieve the VPD file Name, this is optional in DSC file
- def _GetVpdFileName(self):
- if self._VpdFileName == None:
- if self._Header == None:
- self._GetHeaderInfo()
- if self._VpdFileName == None:
- self._VpdFileName = ''
- return self._VpdFileName
-
+
## Retrieve [SkuIds] section information
def _GetSkuIds(self):
if self._SkuIds == None:
@@ -802,8 +790,7 @@ class DscBuildData(PlatformBuildClassObject):
BsBaseAddress = property(_GetBsBaseAddress)
RtBaseAddress = property(_GetRtBaseAddress)
LoadFixAddress = property(_GetLoadFixAddress)
- VpdToolGuid = property(_GetVpdToolGuid)
- VpdFileName = property(_GetVpdFileName)
+ VpdToolGuid = property(_GetVpdToolGuid)
SkuIds = property(_GetSkuIds)
Modules = property(_GetModules)
LibraryInstances = property(_GetLibraryInstances)
@@ -1330,18 +1317,16 @@ class InfBuildData(ModuleBuildClassObject):
if Name in self:
self[Name] = Record[1]
# some special items in [Defines] section need special treatment
- elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
- if self._Specification == None:
- self._Specification = sdict()
- self._Specification['UEFI_SPECIFICATION_VERSION'] = Record[1]
- elif Name == 'EDK_RELEASE_VERSION':
+ elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
+ if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
+ Name = 'UEFI_SPECIFICATION_VERSION'
if self._Specification == None:
self._Specification = sdict()
- self._Specification[Name] = Record[1]
- elif Name == 'PI_SPECIFICATION_VERSION':
- if self._Specification == None:
- self._Specification = sdict()
- self._Specification[Name] = Record[1]
+ self._Specification[Name] = GetHexVerValue(Record[1])
+ if self._Specification[Name] == None:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
+ "'%s' format is not supported for %s" % (Record[1], Name),
+ File=self.MetaFile, Line=Record[-1])
elif Name == 'LIBRARY_CLASS':
if self._LibraryClass == None:
self._LibraryClass = []