diff options
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/DataType.py | 1 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/Expression.py | 4 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/Misc.py | 2 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/ToolDefClassObject.py | 23 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/VpdInfoFile.py | 8 |
5 files changed, 20 insertions, 18 deletions
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index 1d1d22faa4..6b375712b6 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -31,6 +31,7 @@ TAB_OPTION_START = '<' TAB_OPTION_END = '>'
TAB_SLASH = '\\'
TAB_BACK_SLASH = '/'
+TAB_STAR = '*'
TAB_LINE_BREAK = '\n'
TAB_PRINTCHAR_VT = '\x0b'
TAB_PRINTCHAR_BS = '\b'
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index a21ab5daa7..db1310d534 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -244,7 +244,7 @@ class ValueExpression(BaseExpression): 'IN' : 'in'
}
- NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
+ NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
SymbolPattern = re.compile("("
@@ -498,7 +498,7 @@ class ValueExpression(BaseExpression): # A [ * B]*
def _MulExpr(self):
- return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"})
+ return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/", "%"})
# [!]*A
def _UnaryExpr(self):
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 3b8efb2e71..61ba79241f 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1088,7 +1088,7 @@ class tdict: _ListType = type([])
_TupleType = type(())
_Wildcard = 'COMMON'
- _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM']
+ _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR, 'PLATFORM']
def __init__(self, _Single_=False, _Level_=2):
self._Level_ = _Level_
diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseTools/Source/Python/Common/ToolDefClassObject.py index 05a1ddfbcc..186d279840 100644 --- a/BaseTools/Source/Python/Common/ToolDefClassObject.py +++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py @@ -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:
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index 2fb8e66fe9..3be0670e36 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \ # <PcdName> ::= <TokenSpaceCName> "." <PcdCName>
# <TokenSpaceCName> ::= C Variable Name of the Token Space GUID
# <PcdCName> ::= C Variable Name of the PCD
-# <Offset> ::= {"*"} {<HexNumber>}
+# <Offset> ::= {TAB_STAR} {<HexNumber>}
# <HexNumber> ::= "0x" (a-fA-F0-9){1,8}
# <Size> ::= <HexNumber>
# <Value> ::= {<HexNumber>} {<NonNegativeInt>} {<QString>} {<Array>}
@@ -92,7 +92,7 @@ class VpdInfoFile: if (Vpd is None):
EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
- if not (Offset >= 0 or Offset == "*"):
+ if not (Offset >= 0 or Offset == TAB_STAR):
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
if Vpd.DatumType == TAB_VOID:
@@ -186,8 +186,8 @@ class VpdInfoFile: VpdObjectTokenCName = PcdItem[0]
for sku in VpdObject.SkuInfoList:
if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
- if self._VpdArray[VpdObject][sku] == "*":
- if Offset == "*":
+ if self._VpdArray[VpdObject][sku] == TAB_STAR:
+ if Offset == TAB_STAR:
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
self._VpdArray[VpdObject][sku] = Offset
Found = True
|