BaseTools: use predefined constants instead of local strings
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
5a693b89a1
commit
55c84777ee
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# process APRIORI file data and generate PEI/DXE APRIORI file
|
||||
#
|
||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -25,6 +25,7 @@ from Common.String import *
|
||||
from Common.Misc import SaveFileOnChange,PathClass
|
||||
from Common import EdkLogger
|
||||
from Common.BuildToolError import *
|
||||
from Common.DataType import TAB_COMMON
|
||||
|
||||
## process APRIORI file data and generate PEI/DXE APRIORI file
|
||||
#
|
||||
@@ -84,7 +85,7 @@ class AprioriSection (AprioriSectionClassObject):
|
||||
Guid = Inf.Guid
|
||||
|
||||
else:
|
||||
Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
Guid = Inf.Guid
|
||||
|
||||
self.BinFileList = Inf.Module.Binaries
|
||||
|
@@ -52,6 +52,7 @@ from Common.String import NormPath
|
||||
import Common.GlobalData as GlobalData
|
||||
from Common.Expression import *
|
||||
from Common import GlobalData
|
||||
from Common.DataType import *
|
||||
from Common.String import ReplaceMacro
|
||||
import uuid
|
||||
from Common.Misc import tdict
|
||||
@@ -511,8 +512,8 @@ class FdfParser:
|
||||
if Item == '' or Item == 'RULE':
|
||||
return
|
||||
|
||||
if Item == 'DEFINES':
|
||||
self.__CurSection = ['COMMON', 'COMMON', 'COMMON']
|
||||
if Item == TAB_COMMON_DEFINES.upper():
|
||||
self.__CurSection = [TAB_COMMON, TAB_COMMON, TAB_COMMON]
|
||||
elif Item == 'VTF' and len(ItemList) == 3:
|
||||
UiName = ItemList[2]
|
||||
Pos = UiName.find(',')
|
||||
@@ -520,9 +521,9 @@ class FdfParser:
|
||||
UiName = UiName[:Pos]
|
||||
self.__CurSection = ['VTF', UiName, ItemList[1]]
|
||||
elif len(ItemList) > 1:
|
||||
self.__CurSection = [ItemList[0], ItemList[1], 'COMMON']
|
||||
self.__CurSection = [ItemList[0], ItemList[1], TAB_COMMON]
|
||||
elif len(ItemList) > 0:
|
||||
self.__CurSection = [ItemList[0], 'DUMMY', 'COMMON']
|
||||
self.__CurSection = [ItemList[0], 'DUMMY', TAB_COMMON]
|
||||
|
||||
## PreprocessFile() method
|
||||
#
|
||||
@@ -886,7 +887,7 @@ class FdfParser:
|
||||
|
||||
if self.__CurSection:
|
||||
# Defines macro
|
||||
ScopeMacro = self.__MacroDict['COMMON', 'COMMON', 'COMMON']
|
||||
ScopeMacro = self.__MacroDict[TAB_COMMON, TAB_COMMON, TAB_COMMON]
|
||||
if ScopeMacro:
|
||||
MacroDict.update(ScopeMacro)
|
||||
|
||||
@@ -3586,7 +3587,7 @@ class FdfParser:
|
||||
raise Warning("expected '.'", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
Arch = self.__SkippedChars.rstrip(".")
|
||||
if Arch.upper() not in ("IA32", "X64", "IPF", "EBC", "ARM", "AARCH64", "COMMON"):
|
||||
if Arch.upper() not in ARCH_LIST_FULL:
|
||||
raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.CurrentLineNumber)
|
||||
|
||||
ModuleType = self.__GetModuleType()
|
||||
|
@@ -47,6 +47,7 @@ import Common.GlobalData as GlobalData
|
||||
from DepexSection import DepexSection
|
||||
from Common.Misc import SaveFileOnChange
|
||||
from Common.Expression import *
|
||||
from Common.DataType import TAB_COMMON
|
||||
|
||||
## generate FFS from INF
|
||||
#
|
||||
@@ -205,7 +206,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
self.ShadowFromInfFile = Inf.Shadow
|
||||
|
||||
else:
|
||||
Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
self.BaseName = Inf.BaseName
|
||||
self.ModuleGuid = Inf.Guid
|
||||
self.ModuleType = Inf.ModuleType
|
||||
@@ -570,7 +571,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
|
||||
RuleName = 'RULE' + \
|
||||
'.' + \
|
||||
'COMMON' + \
|
||||
TAB_COMMON + \
|
||||
'.' + \
|
||||
self.ModuleType.upper()
|
||||
|
||||
|
@@ -238,11 +238,11 @@ def main():
|
||||
ArchList = Options.archList.split(',')
|
||||
else:
|
||||
# EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH")
|
||||
ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList
|
||||
ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, TAB_COMMON, Options.BuildTarget, Options.ToolChain].SupArchList
|
||||
|
||||
TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList) & set(ArchList)
|
||||
TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, TAB_COMMON, Options.BuildTarget, Options.ToolChain].SupArchList) & set(ArchList)
|
||||
if len(TargetArchList) == 0:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList)))
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, TAB_COMMON].SupArchList)))
|
||||
|
||||
for Arch in ArchList:
|
||||
GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Options.BuildTarget, Options.ToolChain].OutputDirectory)
|
||||
@@ -674,7 +674,7 @@ class GenFds :
|
||||
# @retval None
|
||||
#
|
||||
def PreprocessImage(BuildDb, DscFile):
|
||||
PcdDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds
|
||||
PcdDict = BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds
|
||||
PcdValue = ''
|
||||
for Key in PcdDict:
|
||||
PcdObj = PcdDict[Key]
|
||||
@@ -693,9 +693,9 @@ class GenFds :
|
||||
if Int64PcdValue > 0:
|
||||
TopAddress = Int64PcdValue
|
||||
|
||||
ModuleDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules
|
||||
ModuleDict = BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules
|
||||
for Key in ModuleDict:
|
||||
ModuleObj = BuildDb.BuildObject[Key, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
ModuleObj = BuildDb.BuildObject[Key, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||
print ModuleObj.BaseName + ' ' + ModuleObj.ModuleType
|
||||
|
||||
def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj):
|
||||
|
@@ -130,7 +130,7 @@ class GenFdsGlobalVariable:
|
||||
@staticmethod
|
||||
def GetBuildRules(Inf, Arch):
|
||||
if not Arch:
|
||||
Arch = 'COMMON'
|
||||
Arch = DataType.TAB_COMMON
|
||||
|
||||
if not Arch in GenFdsGlobalVariable.OutputDirDict:
|
||||
return {}
|
||||
@@ -217,7 +217,7 @@ class GenFdsGlobalVariable:
|
||||
FileList.append((File, DataType.TAB_UNKNOWN_FILE))
|
||||
|
||||
for File in Inf.Binaries:
|
||||
if File.Target in ['COMMON', '*', GenFdsGlobalVariable.TargetName]:
|
||||
if File.Target in [DataType.TAB_COMMON, '*', GenFdsGlobalVariable.TargetName]:
|
||||
FileList.append((File, File.Type))
|
||||
|
||||
for File, FileType in FileList:
|
||||
@@ -759,7 +759,7 @@ class GenFdsGlobalVariable:
|
||||
# @param Str String that may contain macro
|
||||
# @param MacroDict Dictionary that contains macro value pair
|
||||
#
|
||||
def MacroExtend (Str, MacroDict={}, Arch='COMMON'):
|
||||
def MacroExtend (Str, MacroDict={}, Arch=DataType.TAB_COMMON):
|
||||
if Str is None :
|
||||
return None
|
||||
|
||||
@@ -771,7 +771,7 @@ class GenFdsGlobalVariable:
|
||||
'$(SPACE)' : ' '
|
||||
}
|
||||
OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[GenFdsGlobalVariable.ArchList[0]]
|
||||
if Arch != 'COMMON' and Arch in GenFdsGlobalVariable.ArchList:
|
||||
if Arch != DataType.TAB_COMMON and Arch in GenFdsGlobalVariable.ArchList:
|
||||
OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[Arch]
|
||||
|
||||
Dict['$(OUTPUT_DIRECTORY)'] = OutputDir
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# section base class
|
||||
#
|
||||
# Copyright (c) 2007-2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -20,6 +20,7 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
import Common.LongFilePathOs as os, glob
|
||||
from Common import EdkLogger
|
||||
from Common.BuildToolError import *
|
||||
from Common.DataType import TAB_ARCH_COMMON
|
||||
|
||||
## section base class
|
||||
#
|
||||
@@ -125,7 +126,7 @@ class Section (SectionClassObject):
|
||||
FileList = []
|
||||
if FileType is not None:
|
||||
for File in FfsInf.BinFileList:
|
||||
if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:
|
||||
if File.Arch == TAB_ARCH_COMMON or FfsInf.CurrentArch == File.Arch:
|
||||
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
|
||||
and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX') \
|
||||
or (FileType == 'TE'and File.Type == 'PE32'):
|
||||
|
Reference in New Issue
Block a user