From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BB7A921191F29 for ; Sun, 2 Dec 2018 18:30:58 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2018 18:30:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,308,1539673200"; d="scan'208";a="124095402" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 02 Dec 2018 18:30:58 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 2 Dec 2018 18:30:57 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 2 Dec 2018 18:30:57 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.59]) by shsmsx102.ccr.corp.intel.com ([169.254.2.182]) with mapi id 14.03.0415.000; Mon, 3 Dec 2018 10:30:54 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*' Thread-Index: AQHUfcKrZ5jeuYmPoEWXJsCSRP4PAKVsYrfg Date: Mon, 3 Dec 2018 02:30:54 +0000 Message-ID: References: <9802d13cdae952a1ef3b344b1cbaa2721689ce99.1542382796.git.jaben.carsey@intel.com> In-Reply-To: <9802d13cdae952a1ef3b344b1cbaa2721689ce99.1542382796.git.jaben.carsey@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*' X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 02:30:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Jaben, In this patch, it also changed the mathematics multiplicative '*' (used in = expression) to TAB_STAR, is it by on purpose?=20 Eg: - NonLetterOpLst =3D ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<',= '>>', '!', '=3D', '>', '<', '?', ':'] + NonLetterOpLst =3D ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', = '<<', '>>', '!', '=3D', '>', '<', '?', ':'] Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Friday, November 16, 2018 11:40 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong ; Gao, Liming Subject: [Patch v1 1/1] BaseTools: create and use a standard shared variabl= e for '*' add a variable for the string '*' and then use it instead of lots of '*' Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 54 ++++++++++----= ------ BaseTools/Source/Python/AutoGen/BuildEngine.py | 10 ++-- BaseTools/Source/Python/BPDG/GenVpd.py | 14 ++--- BaseTools/Source/Python/Common/DataType.py | 1 + BaseTools/Source/Python/Common/Expression.py | 4 +- BaseTools/Source/Python/Common/Misc.py | 2 +- BaseTools/Source/Python/Common/ToolDefClassObject.py | 23 +++++---- BaseTools/Source/Python/Common/VpdInfoFile.py | 8 +-- BaseTools/Source/Python/GenFds/FdfParser.py | 5 +- BaseTools/Source/Python/GenFds/GenFds.py | 2 +- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 8 +-- BaseTools/Source/Python/GenFds/Section.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 6 +-- 13 files changed, 70 insertions(+), 69 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index f3560bfc787d..25417c447061 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen): PcdValue =3D Sku.DefaultValue if PcdValue =3D=3D "": PcdValue =3D Pcd.DefaultValue - if Sku.VpdOffset !=3D '*': + if Sku.VpdOffset !=3D TAB_STAR: if PcdValue.startswith("{"): Alignment =3D 8 elif PcdValue.startswith("L"): @@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen): VpdFile.Add(Pcd, SkuName, Sku.VpdOffset) SkuValueMap[PcdValue].append(Sku) # if the offset of a VPD is *, then it need to be = fixed up by third party tool. - if not NeedProcessVpdMapFile and Sku.VpdOffset =3D= =3D "*": + if not NeedProcessVpdMapFile and Sku.VpdOffset =3D= =3D TAB_STAR: NeedProcessVpdMapFile =3D True if self.Platform.VpdToolGuid is None or self.P= latform.VpdToolGuid =3D=3D '': EdkLogger.error("Build", FILE_NOT_FOUND, \= @@ -1522,7 +1522,7 @@ class PlatformAutoGen(AutoGen): PcdValue =3D Sku.DefaultValue if PcdValue =3D=3D "": PcdValue =3D DscPcdEntry.DefaultValue - if Sku.VpdOffset !=3D '*': + if Sku.VpdOffset !=3D TAB_STAR: if PcdValue.startswith("{"): Alignment =3D 8 elif PcdValue.startswith("L"): @@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen): SkuValueMap[PcdValue] =3D [] VpdFile.Add(DscPcdEntry, SkuName, Sku.= VpdOffset) SkuValueMap[PcdValue].append(Sku) - if not NeedProcessVpdMapFile and Sku.VpdOf= fset =3D=3D "*": + if not NeedProcessVpdMapFile and Sku.VpdOf= fset =3D=3D TAB_STAR: NeedProcessVpdMapFile =3D True if DscPcdEntry.DatumType =3D=3D TAB_VOID and P= cdValue.startswith("L"): UnicodePcdArray.add(DscPcdEntry) @@ -1573,= 7 +1573,7 @@ class PlatformAutoGen(AutoGen): if os.path.exists(VpdMapFilePath): VpdFile.Read(VpdMapFilePath) =20 - # Fixup "*" offset + # Fixup TAB_STAR offset for pcd in VpdSkuMap: vpdinfo =3D VpdFile.GetVpdInfo(pcd) if vpdinfo is None: @@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen): def CalculatePriorityValue(self, Key): Target, ToolChain, Arch, CommandType, Attr =3D Key.split('_') PriorityValue =3D 0x11111 - if Target =3D=3D "*": + if Target =3D=3D TAB_STAR: PriorityValue &=3D 0x01111 - if ToolChain =3D=3D "*": + if ToolChain =3D=3D TAB_STAR: PriorityValue &=3D 0x10111 - if Arch =3D=3D "*": + if Arch =3D=3D TAB_STAR: PriorityValue &=3D 0x11011 - if CommandType =3D=3D "*": + if CommandType =3D=3D TAB_STAR: PriorityValue &=3D 0x11101 - if Attr =3D=3D "*": + if Attr =3D=3D TAB_STAR: PriorityValue &=3D 0x11110 =20 return self.PrioList["0x%0.5x" % PriorityValue] @@ -2253,9 +2253,9= @@ class PlatformAutoGen(AutoGen): if (Key[0] =3D=3D self.BuildRuleFamily and (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and = Key[2] =3D=3D ModuleStyle))): Target, ToolChain, Arch, CommandType, Attr =3D Key[1].spli= t('_') - if (Target =3D=3D self.BuildTarget or Target =3D=3D "*") a= nd\ - (ToolChain =3D=3D self.ToolChain or ToolChain =3D=3D "= *") and\ - (Arch =3D=3D self.Arch or Arch =3D=3D "*") and\ + if (Target =3D=3D self.BuildTarget or Target =3D=3D TAB_ST= AR) and\ + (ToolChain =3D=3D self.ToolChain or ToolChain =3D=3D T= AB_STAR) and\ + (Arch =3D=3D self.Arch or Arch =3D=3D TAB_STAR) and\ Options[Key].startswith("=3D"): =20 if OverrideList.get(Key[1]) is not None: @@ -2276,11 +2276,11 @@ class PlatformAutoGen(AutoGen): # Compare two Key, if one is included by another, choo= se the higher priority one # Target2, ToolChain2, Arch2, CommandType2, Attr2 =3D Ne= xtKey.split("_") - if (Target1 =3D=3D Target2 or Target1 =3D=3D "*" or Ta= rget2 =3D=3D "*") and\ - (ToolChain1 =3D=3D ToolChain2 or ToolChain1 =3D=3D= "*" or ToolChain2 =3D=3D "*") and\ - (Arch1 =3D=3D Arch2 or Arch1 =3D=3D "*" or Arch2 = =3D=3D "*") and\ - (CommandType1 =3D=3D CommandType2 or CommandType1 = =3D=3D "*" or CommandType2 =3D=3D "*") and\ - (Attr1 =3D=3D Attr2 or Attr1 =3D=3D "*" or Attr2 = =3D=3D "*"): + if (Target1 =3D=3D Target2 or Target1 =3D=3D TAB_STAR = or Target2 =3D=3D TAB_STAR) and\ + (ToolChain1 =3D=3D ToolChain2 or ToolChain1 =3D=3D= TAB_STAR or ToolChain2 =3D=3D TAB_STAR) and\ + (Arch1 =3D=3D Arch2 or Arch1 =3D=3D TAB_STAR or Ar= ch2 =3D=3D TAB_STAR) and\ + (CommandType1 =3D=3D CommandType2 or CommandType1 = =3D=3D TAB_STAR or CommandType2 =3D=3D TAB_STAR) and\ + (Attr1 =3D=3D Attr2 or Attr1 =3D=3D TAB_STAR or At= tr2 =3D=3D TAB_STAR): =20 if self.CalculatePriorityValue(NowKey) > self.Calc= ulatePriorityValue(NextKey): if Options.get((self.BuildRuleFamily, NextKey)= ) is not None: @@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen): continue FamilyMatch =3D True # expand any wildcard - if Target =3D=3D "*" or Target =3D=3D self.BuildTarget: - if Tag =3D=3D "*" or Tag =3D=3D self.ToolChain: - if Arch =3D=3D "*" or Arch =3D=3D self.Arch: + if Target =3D=3D TAB_STAR or Target =3D=3D self.BuildTarget: + if Tag =3D=3D TAB_STAR or Tag =3D=3D self.ToolChain: + if Arch =3D=3D TAB_STAR or Arch =3D=3D self.Arch: if Tool not in BuildOptions: BuildOptions[Tool] =3D {} if Attr !=3D "FLAGS" or Attr not in BuildOptions[T= ool] or Options[Key].startswith('=3D'): @@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen): continue =20 # expand any wildcard - if Target =3D=3D "*" or Target =3D=3D self.BuildTarget: - if Tag =3D=3D "*" or Tag =3D=3D self.ToolChain: - if Arch =3D=3D "*" or Arch =3D=3D self.Arch: + if Target =3D=3D TAB_STAR or Target =3D=3D self.BuildTarget: + if Tag =3D=3D TAB_STAR or Tag =3D=3D self.ToolChain: + if Arch =3D=3D TAB_STAR or Arch =3D=3D self.Arch: if Tool not in BuildOptions: BuildOptions[Tool] =3D {} if Attr !=3D "FLAGS" or Attr not in BuildOptions[T= ool] or Options[Key].startswith('=3D'): @@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen): @cached_property def SourceFileList(self): RetVal =3D [] - ToolChainTagSet =3D {"", "*", self.ToolChain} - ToolChainFamilySet =3D {"", "*", self.ToolChainFamily, self.BuildR= uleFamily} + ToolChainTagSet =3D {"", TAB_STAR, self.ToolChain} + ToolChainFamilySet =3D {"", TAB_STAR, self.ToolChainFamily,=20 + self.BuildRuleFamily} for F in self.Module.Sources: # match tool chain if F.TagName not in ToolChainTagSet: @@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen): def BinaryFileList(self): RetVal =3D [] for F in self.Module.Binaries: - if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target !=3D se= lf.BuildTarget: + if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target != =3D self.BuildTarget: continue RetVal.append(F) self._ApplyBuildRule(F, F.Type, BinaryFileList=3DRetVal) diff = --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/P= ython/AutoGen/BuildEngine.py index ac7a6687552c..f9e3ac3a1daf 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -110,7 +110,7 @@ class FileBuildRule: self.IncListFileMacro =3D self.INC_LIST_MACRO =20 self.SourceFileType =3D Type - # source files listed not in "*" or "?" pattern format + # source files listed not in TAB_STAR or "?" pattern format if not ExtraDependency: self.ExtraSourceFileList =3D [] else: @@ -150,12 +150,12 @@ class FileBuildRule: self.SourceFileExtList =3D set() for File in Input: Base, Ext =3D os.path.splitext(File) - if Base.find("*") >=3D 0: - # There's "*" in the file name + if Base.find(TAB_STAR) >=3D 0: + # There's TAB_STAR in the file name self.IsMultipleInput =3D True self.GenFileListMacro =3D True elif Base.find("?") < 0: - # There's no "*" and "?" in file name + # There's no TAB_STAR and "?" in file name self.ExtraSourceFileList.append(File) continue self.SourceFileExtList.add(Ext) @@ -553,7 +553,7 @@ class Buil= dRule: # # @param FileExt The extension of a file # @param ToolChainFamily The tool chain family name - # @param BuildVersion The build version number. "*" means an= y rule + # @param BuildVersion The build version number. TAB_STAR mea= ns any rule # is applicalbe. # # @retval FileType The file type string diff --git a/BaseTools/Source/Python/BPDG/GenVpd.py b/BaseTools/Source/Pyth= on/BPDG/GenVpd.py index d7852d29eed0..e5da47f95e63 100644 --- a/BaseTools/Source/Python/BPDG/GenVpd.py +++ b/BaseTools/Source/Python/BPDG/GenVpd.py @@ -21,7 +21,7 @@ import array import re from Common.LongFilePathSupport import OpenLongFilePath as open from stru= ct import * -from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE +from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE, TAB_STAR import Common.EdkLogger as EdkLogger import Common.BuildToolError as BuildToolError =20 @@ -87,7 +87,7 @@ class PcdEntry: # for both hexadecimal and decimal. # def _GenOffsetValue(self): - if self.PcdOffset !=3D "*" : + if self.PcdOffset !=3D TAB_STAR: try: self.PcdBinOffset =3D int (self.PcdOffset) except: @@ -423,7 +423,7 @@ class GenVPD : Alignment =3D 1 =20 PCD.Alignment =3D Alignment - if PCD.PcdOffset !=3D '*': + if PCD.PcdOffset !=3D TAB_STAR: if PCD.PcdOccupySize % Alignment !=3D 0: if PCD.PcdUnpackValue.startswith("{"): EdkLogger.warn("BPDG", "The offset value of PC= D %s is not 8-byte aligned!" %(PCD.PcdCName), File=3Dself.InputFileName) @@= -469,7 +469,7 @@ class GenVPD : def FormatFileLine (self) : =20 for eachPcd in self.FileLinesList : - if eachPcd.PcdOffset !=3D '*' : + if eachPcd.PcdOffset !=3D TAB_STAR : # Use pcd's Offset value as key, and pcd's Value as value self.PcdFixedOffsetSizeList.append(eachPcd) else : @@ -484,7 +484,7 @@ class GenVPD : def FixVpdOffset (self): # At first, the offset should start at 0 # Sort fixed offset list in order to find out where has free space= s for the pcd's offset - # value is "*" to insert into. + # value is TAB_STAR to insert into. =20 self.PcdFixedOffsetSizeList.sort(key=3Dlambda x: x.PcdBinOffset) =20 @@ -502,7 +502,7 @@ class GenVPD : self.PcdUnknownOffsetList[index+i -1 ], self.PcdUn= knownOffsetList[index+i] =3D self.PcdUnknownOffsetList[index+i], self.PcdUn= knownOffsetList[index+i -1] =20 # - # Process all Offset value are "*" + # Process all Offset value are TAB_STAR # if (len(self.PcdFixedOffsetSizeList) =3D=3D 0) and (len(self.PcdUn= knownOffsetList) !=3D 0) : # The offset start from 0 @@ -571,7 +571,7 @@ class GenVPD : eachUnfixedPcd =3D self.PcdUnknownOffsetList[= countOfUnfixedList] needFixPcdSize =3D eachUnfixedPcd.PcdOccupySi= ze # Not been fixed - if eachUnfixedPcd.PcdOffset =3D=3D '*' : + if eachUnfixedPcd.PcdOffset =3D=3D TAB_STAR : if LastOffset % eachUnfixedPcd.Alignment !=3D = 0: LastOffset =3D (LastOffset / eachUnfixedPc= d.Alignment + 1) * eachUnfixedPcd.Alignment # The offset un-fixed pcd can write into this = free space diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTo= ols/Source/Python/Common/DataType.py index 1d1d22faa40b..6b375712b65e 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -31,6 +31,7 @@ TAB_OPTION_START =3D '<' TAB_OPTION_END =3D '>' TAB_SLASH =3D '\\' TAB_BACK_SLASH =3D '/' +TAB_STAR =3D '*' TAB_LINE_BREAK =3D '\n' TAB_PRINTCHAR_VT =3D '\x0b' TAB_PRINTCHAR_BS =3D '\b' diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index a21ab5daa73e..db1310d534fb 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -244,7 +244,7 @@ class ValueExpression(BaseExpression): 'IN' : 'in' } =20 - NonLetterOpLst =3D ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<',= '>>', '!', '=3D', '>', '<', '?', ':'] + NonLetterOpLst =3D ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~',= =20 + '<<', '>>', '!', '=3D', '>', '<', '?', ':'] =20 =20 SymbolPattern =3D re.compile("(" @@ -498,7 +498,7 @@ class ValueExpression(BaseExpression): =20 # A [ * B]* def _MulExpr(self): - return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"}) + return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/",=20 + "%"}) =20 # [!]*A def _UnaryExpr(self): diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 3b8efb2e7179..61ba79241fb6 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1088,7 +1088,7 @@ class tdict: _ListType =3D type([]) _TupleType =3D type(()) _Wildcard =3D 'COMMON' - _ValidWildcardList =3D ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM'] + _ValidWildcardList =3D ['COMMON', 'DEFAULT', 'ALL', TAB_STAR,=20 + 'PLATFORM'] =20 def __init__(self, _Single_=3DFalse, _Level_=3D2): self._Level_ =3D _Level_ diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseToo= ls/Source/Python/Common/ToolDefClassObject.py index 05a1ddfbcc89..186d279840c1 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.MultipleWorksp= ace 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_BUILDRULEFA= MILY + , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFA= MILY,\ + TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF =20 =20 ## @@ -97,7 +98,7 @@ class ToolDefClassObject(object): # adding/removing items from the original dict. for Key in list(self.ToolsDefTxtDictionary.keys()): List =3D Key.split('_') - if List[Index] =3D=3D '*': + if List[Index] =3D=3D TAB_STAR: for String in self.ToolsDefTxtDatabase[KeyList[Index]]= : List[Index] =3D String NewKey =3D '%s_%s_%s_%s_%s' % tuple(List) @@ -202,= 20 +203,20 @@ class ToolDefClassObject(object): if len(List) !=3D 5: EdkLogger.verbose("Line %d: Not a valid name of definition= : %s" % ((Index + 1), Name)) continue - elif List[4] =3D=3D '*': + elif List[4] =3D=3D TAB_STAR: EdkLogger.verbose("Line %d: '*' is not allowed in last fie= ld: %s" % ((Index + 1), Name)) continue else: self.ToolsDefTxtDictionary[Name] =3D Value - if List[0] !=3D '*': + if List[0] !=3D TAB_STAR: self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] +=3D = [List[0]] - if List[1] !=3D '*': + if List[1] !=3D TAB_STAR: self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TA= G] +=3D [List[1]] - if List[2] !=3D '*': + if List[2] !=3D TAB_STAR: self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] = +=3D [List[2]] - if List[3] !=3D '*': + if List[3] !=3D TAB_STAR: self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]= +=3D [List[3]] - if List[4] =3D=3D TAB_TOD_DEFINES_FAMILY and List[2] =3D= =3D '*' and List[3] =3D=3D '*': + if List[4] =3D=3D TAB_TOD_DEFINES_FAMILY and List[2] =3D= =3D TAB_STAR and List[3] =3D=3D TAB_STAR: if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatab= ase: self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = =3D {} self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][L= ist[1]] =3D Value @@ -226,7 +227,7 @@ class ToolDefClassObject(object): self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULE= FAMILY][List[1]] =3D Value elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][= List[1]] !=3D Value: EdkLogger.verbose("Line %d: No override allowed fo= r the family of a tool chain: %s" % ((Index + 1), Name)) - if List[4] =3D=3D TAB_TOD_DEFINES_BUILDRULEFAMILY and List= [2] =3D=3D '*' and List[3] =3D=3D '*': + if List[4] =3D=3D TAB_TOD_DEFINES_BUILDRULEFAMILY and List= [2] =3D=3D TAB_STAR and List[3] =3D=3D TAB_STAR: if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDe= fTxtDatabase \ or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_= DEFINES_FAMILY]: EdkLogger.verbose("Line %d: The family is not spec= ified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index += 1), Name)) @@ -270,8 +271,8 @@ class ToolDefClassObject(object): def ToolDefDict(ConfDir): Target =3D TargetTxtDict(ConfDir) ToolDef =3D ToolDefClassObject() - if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDiction= ary: - ToolsDefFile =3D Target.TargetTxtDictionary[DataType.TAB_TAT_DEFIN= ES_TOOL_CHAIN_CONF] + if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary: + ToolsDefFile =3D=20 + 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/Sour= ce/Python/Common/VpdInfoFile.py index 2fb8e66fe99c..3be0670e36fb 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE =3D \ # ::=3D "." # ::=3D C Variable Name of the Token Space GUID # ::=3D C Variable Name of the PCD -# ::=3D {"*"} {} +# ::=3D {TAB_STAR} {} # ::=3D "0x" (a-fA-F0-9){1,8} # ::=3D # ::=3D {} {} {} {= } @@ -92,7 +92,7 @@ class VpdInfoFile: if (Vpd is None): EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOW= N_ERROR, "Invalid VPD PCD entry.") =20 - if not (Offset >=3D 0 or Offset =3D=3D "*"): + if not (Offset >=3D 0 or Offset =3D=3D TAB_STAR): EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALI= D, "Invalid offset parameter: %s." % Offset) =20 if Vpd.DatumType =3D=3D TAB_VOID: @@ -186,8 +186,8 @@ class VpdInfoFile: VpdObjectTokenCName =3D PcdItem[0] for sku in VpdObject.SkuInfoList: if VpdObject.TokenSpaceGuidCName =3D=3D TokenSpaceName= and VpdObjectTokenCName =3D=3D PcdTokenName.strip() and sku =3D=3D SkuId: - if self._VpdArray[VpdObject][sku] =3D=3D "*": - if Offset =3D=3D "*": + if self._VpdArray[VpdObject][sku] =3D=3D TAB_STAR: + if Offset =3D=3D TAB_STAR: EdkLogger.error("BPDG", BuildToolError.FOR= MAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG to= ol." % PcdName) self._VpdArray[VpdObject][sku] =3D Offset Found =3D True diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 44cc8f63d07b..cedc4ea0c122 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -64,7 +64,6 @@ T_CHAR_CR =3D '\r' T_CHAR_TAB =3D '\t' T_CHAR_DOUBLE_QUOTE =3D '\"' T_CHAR_SINGLE_QUOTE =3D '\'' -T_CHAR_STAR =3D '*' T_CHAR_BRACE_R =3D '}' =20 SEPARATORS =3D {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', T_= CHAR_BRACE_R} @@ -533,7 +532,7 @@ class FdfParser: InComment =3D False HashComment =3D False # check for */ comment end - elif InComment and not DoubleSlashComment and not HashComment = and self._CurrentChar() =3D=3D T_CHAR_STAR and self._NextChar() =3D=3D TAB_= BACK_SLASH: + elif InComment and not DoubleSlashComment and not HashComment = and self._CurrentChar() =3D=3D TAB_STAR and self._NextChar() =3D=3D TAB_BAC= K_SLASH: self._SetCurrentCharValue(TAB_SPACE_SPLIT) self._GetOneChar() self._SetCurrentCharValue(TAB_SPACE_SPLIT) @@ -552,7 +551,7 @@ class FdfParser: InComment =3D True HashComment =3D True # check for /* comment start - elif self._CurrentChar() =3D=3D TAB_BACK_SLASH and self._NextC= har() =3D=3D T_CHAR_STAR: + elif self._CurrentChar() =3D=3D TAB_BACK_SLASH and self._NextC= har() =3D=3D TAB_STAR: self._SetCurrentCharValue(TAB_SPACE_SPLIT) self._GetOneChar() self._SetCurrentCharValue(TAB_SPACE_SPLIT) diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index 0c8091b79841..0513f488fca3 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -653,7 +653,7 @@ class GenFds(object): FileGuidList.append(FileStatementGuid) Name =3D [] FfsPath =3D os.path.join(GenFdsGlobalVariable.FvDi= r, 'Ffs') - FfsPath =3D glob(os.path.join(FfsPath, FileStateme= ntGuid) + '*') + FfsPath =3D glob(os.path.join(FfsPath,=20 + FileStatementGuid) + TAB_STAR) if not FfsPath: continue if not os.path.exists(FfsPath[0]): diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index ea61f723a73c..0812c56bdae8 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -217,12 +217,12 @@ class GenFdsGlobalVariable: =20 if not Inf.IsBinaryModule: for File in Inf.Sources: - if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChai= nTag} and \ - File.ToolChainFamily in {"", "*", GenFdsGlobalVariable= .ToolChainFamily}: + if File.TagName in {"", DataType.TAB_STAR, GenFdsGlobalVar= iable.ToolChainTag} and \ + File.ToolChainFamily in {"", DataType.TAB_STAR, GenFds= GlobalVariable.ToolChainFamily}: FileList.append((File, DataType.TAB_UNKNOWN_FILE)) =20 for File in Inf.Binaries: - if File.Target in {DataType.TAB_COMMON, '*', GenFdsGlobalVaria= ble.TargetName}: + if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR, Gen= FdsGlobalVariable.TargetName}: FileList.append((File, File.Type)) =20 for File, FileType in FileList: @@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, Name= Guid): for Index in range(2, -1, -1): for Key in list(BuildOption.keys()): List =3D Key.split('_') - if List[Index] =3D=3D '*': + if List[Index] =3D=3D DataType.TAB_STAR: for String in ToolDb[ToolList[Index]]: if String in [Arch, GenFdsGlobalVariable.Targe= tName, GenFdsGlobalVariable.ToolChainTag]: List[Index] =3D String diff --git a/BaseTo= ols/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Sectio= n.py index 19a70009dcce..bab74aedf0b9 100644 --- a/BaseTools/Source/Python/GenFds/Section.py +++ b/BaseTools/Source/Python/GenFds/Section.py @@ -131,7 +131,7 @@ class Section (SectionClassObject): if File.Type =3D=3D FileType or (int(FfsInf.PiSpecVers= ion, 16) >=3D 0x0001000A \ and FileType =3D=3D 'DXE_= DPEX' and File.Type =3D=3D BINARY_FILE_TYPE_SMM_DEPEX) \ or (FileType =3D=3D BINAR= Y_FILE_TYPE_TE and File.Type =3D=3D BINARY_FILE_TYPE_PE32): - if '*' in FfsInf.TargetOverrideList or File.Target= =3D=3D '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOve= rrideList =3D=3D []: + if TAB_STAR in FfsInf.TargetOverrideList or File.T= arget =3D=3D TAB_STAR or File.Target in FfsInf.TargetOverrideList or FfsInf= .TargetOverrideList =3D=3D []: FileList.append(FfsInf.PatchEfiFile(File.Path,= File.Type)) else: GenFdsGlobalVariable.InfLogger ("\nBuild Targe= t \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %= (File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName)) di= ff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/So= urce/Python/Workspace/DscBuildData.py index 11aa63fb263c..22cbbb119a5a 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject): continue if Attr !=3D "FLAGS": continue - if Target =3D=3D "*" or Target =3D=3D self._Target: - if Tag =3D=3D "*" or Tag =3D=3D self._Toolchain: + if Target =3D=3D TAB_STAR or Target =3D=3D self._Target: + if Tag =3D=3D TAB_STAR or Tag =3D=3D self._Toolchain: if 'COMMON' not in BuildOptions: BuildOptions['COMMON'] =3D set() - if Arch =3D=3D "*": + if Arch =3D=3D TAB_STAR: BuildOptions['COMMON'].add(self.BuildOptions[Optio= ns]) if Arch in self.SupArchList: if Arch not in BuildOptions: -- 2.16.2.windows.1