X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FExpression.py;h=9a844b0417f203fd6c26a95fe283e81a56a2f1c3;hp=09240de6978180050be22a554293ce86b38f9593;hb=cc0321f22ac7422a2d477c98fed209547eaf0cb5;hpb=e52aed0d855218f23cbd94629561eb4155936cec diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 09240de697..9a844b0417 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -936,12 +936,13 @@ class ValueExpressionEx(ValueExpression): OffsetList = _ReOffset.findall(Item) except: pass + # replace each offset, except errors for Offset in OffsetList: - if Offset in LabelDict.keys(): - Re = re.compile('OFFSET_OF\(%s\)' % Offset) - Item = Re.sub(LabelDict[Offset], Item) - else: + try: + Item = Item.replace('OFFSET_OF({})'.format(Offset),LabelDict[Offset]) + except: raise BadExpression('%s not defined' % Offset) + NewPcdValueList.append(Item) AllPcdValueList = []