BaseTools: create and use a standard shared variable for '*'
add a variable for the string '*' and then use it instead of lots of '*' Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by : Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
@ -29,7 +29,8 @@ from Common import GlobalData
|
||||
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
||||
from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
|
||||
TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\
|
||||
, TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY
|
||||
, TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY,\
|
||||
TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
|
||||
|
||||
|
||||
##
|
||||
@ -97,7 +98,7 @@ class ToolDefClassObject(object):
|
||||
# adding/removing items from the original dict.
|
||||
for Key in list(self.ToolsDefTxtDictionary.keys()):
|
||||
List = Key.split('_')
|
||||
if List[Index] == '*':
|
||||
if List[Index] == TAB_STAR:
|
||||
for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
|
||||
List[Index] = String
|
||||
NewKey = '%s_%s_%s_%s_%s' % tuple(List)
|
||||
@ -202,20 +203,20 @@ class ToolDefClassObject(object):
|
||||
if len(List) != 5:
|
||||
EdkLogger.verbose("Line %d: Not a valid name of definition: %s" % ((Index + 1), Name))
|
||||
continue
|
||||
elif List[4] == '*':
|
||||
elif List[4] == TAB_STAR:
|
||||
EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" % ((Index + 1), Name))
|
||||
continue
|
||||
else:
|
||||
self.ToolsDefTxtDictionary[Name] = Value
|
||||
if List[0] != '*':
|
||||
if List[0] != TAB_STAR:
|
||||
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] += [List[0]]
|
||||
if List[1] != '*':
|
||||
if List[1] != TAB_STAR:
|
||||
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] += [List[1]]
|
||||
if List[2] != '*':
|
||||
if List[2] != TAB_STAR:
|
||||
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
|
||||
if List[3] != '*':
|
||||
if List[3] != TAB_STAR:
|
||||
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] += [List[3]]
|
||||
if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3] == '*':
|
||||
if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
|
||||
if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
|
||||
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
|
||||
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value
|
||||
@ -226,7 +227,7 @@ class ToolDefClassObject(object):
|
||||
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
|
||||
elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value:
|
||||
EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))
|
||||
if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*' and List[3] == '*':
|
||||
if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
|
||||
if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \
|
||||
or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
|
||||
EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))
|
||||
@ -270,8 +271,8 @@ class ToolDefClassObject(object):
|
||||
def ToolDefDict(ConfDir):
|
||||
Target = TargetTxtDict(ConfDir)
|
||||
ToolDef = ToolDefClassObject()
|
||||
if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
|
||||
ToolsDefFile = Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
|
||||
if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
|
||||
ToolsDefFile = Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
|
||||
if ToolsDefFile:
|
||||
ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
|
||||
else:
|
||||
|
Reference in New Issue
Block a user