From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 A2D982117B57A for ; Thu, 25 Oct 2018 22:25:14 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2018 22:25:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,426,1534834800"; d="scan'208";a="81707041" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga008.fm.intel.com with ESMTP; 25 Oct 2018 22:25:13 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 Oct 2018 22:25:10 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.199]) with mapi id 14.03.0415.000; Fri, 26 Oct 2018 13:25:02 +0800 From: "Gao, Liming" To: Gary Lin , "Carsey, Jaben" CC: "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch v3 1/6] BaseTools/GenFds: cleanup GenFds Thread-Index: AQHUavYA+giNGHWfeUWn/OiIjC6xRKUwc8iAgACOn/A= Date: Fri, 26 Oct 2018 05:25:02 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E35EFC0@SHSMSX104.ccr.corp.intel.com> References: <7064a2912d4507d29b00208fe7adb6a90b321e63.1540315635.git.jaben.carsey@intel.com> <20181026045359.GA18048@GaryWorkstation> In-Reply-To: <20181026045359.GA18048@GaryWorkstation> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTgyMzAxODUtMmI3My00MmQ1LTllOGQtN2VjMmI5MDA4Zjg5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNkxxdFNnU1AxNFJWWEp6SlwvRXpnaTAzM3JaRnF2UHMwM0VZcHZ2WStuU3pBWm5pY25cL1MralZZM1c2a2FaZEpaIn0= dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch v3 1/6] BaseTools/GenFds: cleanup GenFds 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: Fri, 26 Oct 2018 05:25:14 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Lin: I am checking this issue. Sorry for the break.=20 Thanks Liming > -----Original Message----- > From: Gary Lin [mailto:glin@suse.com] > Sent: Friday, October 26, 2018 12:54 PM > To: Carsey, Jaben > Cc: edk2-devel@lists.01.org; Gao, Liming > Subject: Re: [edk2] [Patch v3 1/6] BaseTools/GenFds: cleanup GenFds >=20 > On Tue, Oct 23, 2018 at 10:29:19AM -0700, Jaben Carsey wrote: > > 1) remove wildcard imports and use explicit imports > > 2) refactor to use shared variables from Common/DataType > > 3) rename to not shadow imports > > 4) don't assign a variable in a loop (just do final assignment) > > 5) remove spaces, parens, unused or commented out code, etc. > > 6) merge unnecessary parent classes into child > > 7) refactor to share DXE and PEI apriori GUIDs from one place > > this includes changes to Build and EOT files > > 8) for PEP8, dont use __ for custom methods. > > > Hi Jaben, >=20 > I found OVMF crashed immediately at starting up after applying this patch= :-\ >=20 > =3D=3D >=20 > $ qemu-system-x86_64 -s -enable-kvm -smp 1 -m 1024 \ > -drive if=3Dpflash,format=3Draw,readonly,file=3D/home/gary/git/edk2/Bui= ld/OvmfX64/DEBUG_GCC5/FV/OVMF_CODE.fd \ > -drive if=3Dpflash,format=3Draw,file=3D/home/gary/git/edk2/Build/OvmfX6= 4/DEBUG_GCC5/FV/OVMF_VARS.fd \ > -machine type=3Dq35 \ > -drive file=3Dfat:hda-contents/,format=3Draw,read-only,if=3Dvirtio \ > -monitor stdio -debugcon file:debug.log -global isa-debugcon.iobase=3D0= x402 \ > -serial file:serial.log > QEMU 3.0.0 monitor - type 'help' for more information > (qemu) KVM internal error. Suberror: 1 > emulation failure > RAX=3D000000000081f6a0 RBX=3D0000000000000200 RCX=3D000000000081f6a0 RDX= =3D0000000000000200 > RSI=3D000000000081f698 RDI=3D000000000081fd20 RBP=3D000000000081f698 RSP= =3D000000000081f4a8 > R8 =3D000000000081f4d8 R9 =3D000000000081f748 R10=3D0000000000000010 R11= =3D0000000000900000 > R12=3D0000000000000000 R13=3D0000000000820000 R14=3D000000000081fd01 R15= =3D000000000081fd01 > RIP=3D000000000009ffff RFL=3D00010807 [-O---PC] CPL=3D0 II=3D0 A20=3D1 SM= M=3D0 HLT=3D0 > ES =3D0008 0000000000000000 ffffffff 00c09300 DPL=3D0 DS [-WA] > CS =3D0018 0000000000000000 ffffffff 00a09b00 DPL=3D0 CS64 [-RA] > SS =3D0008 0000000000000000 ffffffff 00c09300 DPL=3D0 DS [-WA] > DS =3D0008 0000000000000000 ffffffff 00c09300 DPL=3D0 DS [-WA] > FS =3D0008 0000000000000000 ffffffff 00c09300 DPL=3D0 DS [-WA] > GS =3D0008 0000000000000000 ffffffff 00c09300 DPL=3D0 DS [-WA] > LDT=3D0000 0000000000000000 0000ffff 00008200 DPL=3D0 LDT > TR =3D0000 0000000000000000 0000ffff 00008b00 DPL=3D0 TSS64-busy > GDT=3D 00000000ffffff80 0000001f > IDT=3D 000000000081fd70 0000021f > CR0=3Dc0000033 CR2=3D0000000000000000 CR3=3D0000000000800000 CR4=3D000006= 60 > DR0=3D0000000000000000 DR1=3D0000000000000000 DR2=3D0000000000000000 DR3= =3D0000000000000000 > DR6=3D00000000ffff0ff0 DR7=3D0000000000000400 > EFER=3D0000000000000500 > Code=3D00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <00> 0= 0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > 00 00 00 00 00 00 00 00 00 >=20 > =3D=3D >=20 > And, there is only one line in debug.log: >=20 > SecCoreStartupWithStack(0xFFFCC000, 0x820000) >=20 > Without "-enable-kvm", the error became: >=20 > =3D=3D >=20 > (qemu) qemu-system-x86_64: Trying to execute code outside RAM or ROM at 0= x00000000000a0000 > This usually means one of the following happened: >=20 > (1) You told QEMU to execute a kernel for the wrong machine type, and it = crashed on startup (eg trying to run a raspberry pi kernel on a > versatilepb QEMU machine) > (2) You didn't give QEMU a kernel or BIOS filename at all, and QEMU execu= ted a ROM full of no-op instructions until it fell off the end > (3) Your guest kernel has a bug and crashed by jumping off into nowhere >=20 > This is almost always one of the first two, so check your command line an= d that you are using the right type of kernel for this machine. > If you think option (3) is likely then you can try debugging your guest w= ith the -d debug options; in particular -d guest_errors will cause > the log to include a dump of the guest register state at this point. >=20 > Execution cannot continue; stopping here. >=20 > =3D=3D >=20 > Gary Lin >=20 > > Cc: Yonghong Zhu > > Cc: Liming Gao > > Cc: Bob C Feng > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Jaben Carsey > > --- > > BaseTools/Source/Python/CommonDataClass/FdfClass.py | 73 - > > BaseTools/Source/Python/Eot/EotMain.py | 372 ++- > > BaseTools/Source/Python/GenFds/AprioriSection.py | 45 +- > > BaseTools/Source/Python/GenFds/Capsule.py | 26 +- > > BaseTools/Source/Python/GenFds/CapsuleData.py | 1 - > > BaseTools/Source/Python/GenFds/CompressSection.py | 4 +- > > BaseTools/Source/Python/GenFds/DataSection.py | 4 +- > > BaseTools/Source/Python/GenFds/DepexSection.py | 5 +- > > BaseTools/Source/Python/GenFds/EfiSection.py | 16 +- > > BaseTools/Source/Python/GenFds/FdfParser.py | 3014 ++++++++= ++---------- > > BaseTools/Source/Python/GenFds/Ffs.py | 82 +- > > BaseTools/Source/Python/GenFds/FfsFileStatement.py | 37 +- > > BaseTools/Source/Python/GenFds/FfsInfStatement.py | 10 +- > > BaseTools/Source/Python/GenFds/Fv.py | 47 +- > > BaseTools/Source/Python/GenFds/FvImageSection.py | 6 +- > > BaseTools/Source/Python/GenFds/GenFds.py | 160 +- > > BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 208 +- > > BaseTools/Source/Python/GenFds/GuidSection.py | 4 +- > > BaseTools/Source/Python/GenFds/OptionRom.py | 6 +- > > BaseTools/Source/Python/GenFds/Region.py | 12 +- > > BaseTools/Source/Python/GenFds/UiSection.py | 4 +- > > BaseTools/Source/Python/GenFds/VerSection.py | 16 +- > > BaseTools/Source/Python/GenFds/Vtf.py | 48 +- > > BaseTools/Source/Python/build/BuildReport.py | 5 +- > > 24 files changed, 2185 insertions(+), 2020 deletions(-) > > > > diff --git a/BaseTools/Source/Python/CommonDataClass/FdfClass.py b/Base= Tools/Source/Python/CommonDataClass/FdfClass.py > > index 64b58c2078a3..3df82082457f 100644 > > --- a/BaseTools/Source/Python/CommonDataClass/FdfClass.py > > +++ b/BaseTools/Source/Python/CommonDataClass/FdfClass.py > > @@ -37,50 +37,6 @@ class FDClassObject: > > self.RegionList =3D [] > > self.vtfRawDict =3D {} > > > > -## FV data in FDF > > -# > > -# > > -class FvClassObject: > > - ## The constructor > > - # > > - # @param self The object pointer > > - # > > - def __init__(self): > > - self.UiFvName =3D None > > - self.CreateFileName =3D None > > - # 3-tuple list (blockSize, numBlocks, pcd) > > - self.BlockSizeList =3D [] > > - # DefineVarDict[var] =3D value > > - self.DefineVarDict =3D {} > > - # SetVarDict[var] =3D value > > - self.SetVarDict =3D {} > > - self.FvAlignment =3D None > > - # FvAttributeDict[attribute] =3D TRUE/FALSE (1/0) > > - self.FvAttributeDict =3D {} > > - self.FvNameGuid =3D None > > - self.FvNameString =3D None > > - self.AprioriSectionList =3D [] > > - self.FfsList =3D [] > > - self.BsBaseAddress =3D None > > - self.RtBaseAddress =3D None > > - > > -## Region data in FDF > > -# > > -# > > -class RegionClassObject: > > - ## The constructor > > - # > > - # @param self The object pointer > > - # > > - def __init__(self): > > - self.Offset =3D None # The begin position of the Region > > - self.Size =3D None # The Size of the Region > > - self.PcdOffset =3D None > > - self.PcdSize =3D None > > - self.SetVarDict =3D {} > > - self.RegionType =3D None > > - self.RegionDataList =3D [] > > - > > ## FFS data in FDF > > # > > # > > @@ -112,7 +68,6 @@ class FileStatementClassObject (FfsClassObject) : > > self.FvName =3D None > > self.FdName =3D None > > self.DefineVarDict =3D {} > > - self.AprioriSection =3D None > > self.KeepReloc =3D None > > > > ## INF statement data in FDF > > @@ -134,19 +89,6 @@ class FfsInfStatementClassObject(FfsClassObject): > > self.KeepReloc =3D None > > self.UseArch =3D None > > > > -## APRIORI section data in FDF > > -# > > -# > > -class AprioriSectionClassObject: > > - ## The constructor > > - # > > - # @param self The object pointer > > - # > > - def __init__(self): > > - # DefineVarDict[var] =3D value > > - self.DefineVarDict =3D {} > > - self.FfsList =3D [] > > - > > ## section data in FDF > > # > > # > > @@ -363,21 +305,6 @@ class CapsuleClassObject : > > self.CapsuleDataList =3D [] > > self.FmpPayloadList =3D [] > > > > -## VTF data in FDF > > -# > > -# > > -class VtfClassObject : > > - ## The constructor > > - # > > - # @param self The object pointer > > - # > > - def __init__(self): > > - self.KeyArch =3D None > > - self.ArchList =3D None > > - self.UiName =3D None > > - self.ResetBin =3D None > > - self.ComponentStatementList =3D [] > > - > > ## VTF component data in FDF > > # > > # > > diff --git a/BaseTools/Source/Python/Eot/EotMain.py b/BaseTools/Source/= Python/Eot/EotMain.py > > index 49a1494126c4..2ad93cc6b4e3 100644 > > --- a/BaseTools/Source/Python/Eot/EotMain.py > > +++ b/BaseTools/Source/Python/Eot/EotMain.py > > @@ -36,10 +36,9 @@ import struct > > import uuid > > import copy > > import codecs > > +from GenFds.AprioriSection import DXE_APRIORI_GUID, PEI_APRIORI_GUID > > > > gGuidStringFormat =3D "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02= X" > > -gPeiAprioriFileNameGuid =3D '1b45cc0a-156a-428a-af62-49864da0e6e6' > > -gAprioriGuid =3D 'fc510ee7-ffdc-11d4-bd41-0080c73c8881' > > gIndention =3D -4 > > > > class Image(array): > > @@ -402,10 +401,10 @@ class FirmwareVolume(Image): > > if Ffs.Type =3D=3D 0x05: > > FfsDxeCoreGuid =3D FfsID > > continue > > - if Ffs.Guid.lower() =3D=3D gPeiAprioriFileNameGuid: > > + if Ffs.Guid.lower() =3D=3D PEI_APRIORI_GUID.lower(): > > FfsPeiPrioriGuid =3D FfsID > > continue > > - if Ffs.Guid.lower() =3D=3D gAprioriGuid: > > + if Ffs.Guid.lower() =3D=3D DXE_APRIORI_GUID.lower(): > > FfsDxePrioriGuid =3D FfsID > > continue > > > > @@ -1084,6 +1083,371 @@ class Ffs(Image): > > State =3D property(_GetState, _SetState) > > > > > > + _FfsGuid =3D "8C8CE578-8A3D-4F1C-9935-896185C32DD3" > > + > > + _GUID_ =3D struct.Struct("16x 1I2H8B") > > + _LENGTH_ =3D struct.Struct("16x 16x 1Q") > > + _SIG_ =3D struct.Struct("16x 16x 8x 1I") > > + _ATTR_ =3D struct.Struct("16x 16x 8x 4x 1I") > > + _HLEN_ =3D struct.Struct("16x 16x 8x 4x 4x 1H") > > + _CHECKSUM_ =3D struct.Struct("16x 16x 8x 4x 4x 2x 1H") > > + > > + def __init__(self, Name=3D''): > > + Image.__init__(self) > > + self.Name =3D Name > > + self.FfsDict =3D sdict() > > + self.OrderedFfsDict =3D sdict() > > + self.UnDispatchedFfsDict =3D sdict() > > + self.ProtocolList =3D sdict() > > + > > + def CheckArchProtocol(self): > > + for Item in EotGlobalData.gArchProtocolGuids: > > + if Item.lower() not in EotGlobalData.gProtocolList: > > + return False > > + return True > > + > > + def ParseDepex(self, Depex, Type): > > + List =3D None > > + if Type =3D=3D 'Ppi': > > + List =3D EotGlobalData.gPpiList > > + if Type =3D=3D 'Protocol': > > + List =3D EotGlobalData.gProtocolList > > + DepexStack =3D [] > > + DepexList =3D [] > > + DepexString =3D '' > > + FileDepex =3D None > > + CouldBeLoaded =3D True > > + for Index in range(0, len(Depex.Expression)): > > + Item =3D Depex.Expression[Index] > > + if Item =3D=3D 0x00: > > + Index =3D Index + 1 > > + Guid =3D gGuidStringFormat % Depex.Expression[Index] > > + if Guid in self.OrderedFfsDict and Depex.Expression[In= dex + 1] =3D=3D 0x08: > > + return (True, 'BEFORE %s' % Guid, [Guid, 'BEFORE']= ) > > + elif Item =3D=3D 0x01: > > + Index =3D Index + 1 > > + Guid =3D gGuidStringFormat % Depex.Expression[Index] > > + if Guid in self.OrderedFfsDict and Depex.Expression[In= dex + 1] =3D=3D 0x08: > > + return (True, 'AFTER %s' % Guid, [Guid, 'AFTER']) > > + elif Item =3D=3D 0x02: > > + Index =3D Index + 1 > > + Guid =3D gGuidStringFormat % Depex.Expression[Index] > > + if Guid.lower() in List: > > + DepexStack.append(True) > > + DepexList.append(Guid) > > + else: > > + DepexStack.append(False) > > + DepexList.append(Guid) > > + continue > > + elif Item =3D=3D 0x03 or Item =3D=3D 0x04: > > + DepexStack.append(eval(str(DepexStack.pop()) + ' ' + D= epex._OPCODE_STRING_[Item].lower() + ' ' + > str(DepexStack.pop()))) > > + DepexList.append(str(DepexList.pop()) + ' ' + Depex._O= PCODE_STRING_[Item].upper() + ' ' + str(DepexList.pop())) > > + elif Item =3D=3D 0x05: > > + DepexStack.append(eval(Depex._OPCODE_STRING_[Item].low= er() + ' ' + str(DepexStack.pop()))) > > + DepexList.append(Depex._OPCODE_STRING_[Item].lower() += ' ' + str(DepexList.pop())) > > + elif Item =3D=3D 0x06: > > + DepexStack.append(True) > > + DepexList.append('TRUE') > > + DepexString =3D DepexString + 'TRUE' + ' ' > > + elif Item =3D=3D 0x07: > > + DepexStack.append(False) > > + DepexList.append('False') > > + DepexString =3D DepexString + 'FALSE' + ' ' > > + elif Item =3D=3D 0x08: > > + if Index !=3D len(Depex.Expression) - 1: > > + CouldBeLoaded =3D False > > + else: > > + CouldBeLoaded =3D DepexStack.pop() > > + else: > > + CouldBeLoaded =3D False > > + if DepexList !=3D []: > > + DepexString =3D DepexList[0].strip() > > + return (CouldBeLoaded, DepexString, FileDepex) > > + > > + def Dispatch(self, Db =3D None): > > + if Db is None: > > + return False > > + self.UnDispatchedFfsDict =3D copy.copy(self.FfsDict) > > + # Find PeiCore, DexCore, PeiPriori, DxePriori first > > + FfsSecCoreGuid =3D None > > + FfsPeiCoreGuid =3D None > > + FfsDxeCoreGuid =3D None > > + FfsPeiPrioriGuid =3D None > > + FfsDxePrioriGuid =3D None > > + for FfsID in self.UnDispatchedFfsDict: > > + Ffs =3D self.UnDispatchedFfsDict[FfsID] > > + if Ffs.Type =3D=3D 0x03: > > + FfsSecCoreGuid =3D FfsID > > + continue > > + if Ffs.Type =3D=3D 0x04: > > + FfsPeiCoreGuid =3D FfsID > > + continue > > + if Ffs.Type =3D=3D 0x05: > > + FfsDxeCoreGuid =3D FfsID > > + continue > > + if Ffs.Guid.lower() =3D=3D PEI_APRIORI_GUID.lower(): > > + FfsPeiPrioriGuid =3D FfsID > > + continue > > + if Ffs.Guid.lower() =3D=3D DXE_APRIORI_GUID.lower(): > > + FfsDxePrioriGuid =3D FfsID > > + continue > > + > > + # Parse SEC_CORE first > > + if FfsSecCoreGuid is not None: > > + self.OrderedFfsDict[FfsSecCoreGuid] =3D self.UnDispatchedF= fsDict.pop(FfsSecCoreGuid) > > + self.LoadPpi(Db, FfsSecCoreGuid) > > + > > + # Parse PEI first > > + if FfsPeiCoreGuid is not None: > > + self.OrderedFfsDict[FfsPeiCoreGuid] =3D self.UnDispatchedF= fsDict.pop(FfsPeiCoreGuid) > > + self.LoadPpi(Db, FfsPeiCoreGuid) > > + if FfsPeiPrioriGuid is not None: > > + # Load PEIM described in priori file > > + FfsPeiPriori =3D self.UnDispatchedFfsDict.pop(FfsPeiPr= ioriGuid) > > + if len(FfsPeiPriori.Sections) =3D=3D 1: > > + Section =3D FfsPeiPriori.Sections.popitem()[1] > > + if Section.Type =3D=3D 0x19: > > + GuidStruct =3D struct.Struct('1I2H8B') > > + Start =3D 4 > > + while len(Section) > Start: > > + Guid =3D GuidStruct.unpack_from(Section[St= art : Start + 16]) > > + GuidString =3D gGuidStringFormat % Guid > > + Start =3D Start + 16 > > + if GuidString in self.UnDispatchedFfsDict: > > + self.OrderedFfsDict[GuidString] =3D se= lf.UnDispatchedFfsDict.pop(GuidString) > > + self.LoadPpi(Db, GuidString) > > + > > + self.DisPatchPei(Db) > > + > > + # Parse DXE then > > + if FfsDxeCoreGuid is not None: > > + self.OrderedFfsDict[FfsDxeCoreGuid] =3D self.UnDispatchedF= fsDict.pop(FfsDxeCoreGuid) > > + self.LoadProtocol(Db, FfsDxeCoreGuid) > > + if FfsDxePrioriGuid is not None: > > + # Load PEIM described in priori file > > + FfsDxePriori =3D self.UnDispatchedFfsDict.pop(FfsDxePr= ioriGuid) > > + if len(FfsDxePriori.Sections) =3D=3D 1: > > + Section =3D FfsDxePriori.Sections.popitem()[1] > > + if Section.Type =3D=3D 0x19: > > + GuidStruct =3D struct.Struct('1I2H8B') > > + Start =3D 4 > > + while len(Section) > Start: > > + Guid =3D GuidStruct.unpack_from(Section[St= art : Start + 16]) > > + GuidString =3D gGuidStringFormat % Guid > > + Start =3D Start + 16 > > + if GuidString in self.UnDispatchedFfsDict: > > + self.OrderedFfsDict[GuidString] =3D se= lf.UnDispatchedFfsDict.pop(GuidString) > > + self.LoadProtocol(Db, GuidString) > > + > > + self.DisPatchDxe(Db) > > + > > + def LoadProtocol(self, Db, ModuleGuid): > > + SqlCommand =3D """select GuidValue from Report > > + where SourceFileFullPath in > > + (select Value1 from Inf where BelongsToFile = =3D > > + (select BelongsToFile from Inf > > + where Value1 =3D 'FILE_GUID' and Value2 like '= %s' and Model =3D %s) > > + and Model =3D %s) > > + and ItemType =3D 'Protocol' and ItemMode =3D '= Produced'""" \ > > + % (ModuleGuid, 5001, 3007) > > + RecordSet =3D Db.TblReport.Exec(SqlCommand) > > + for Record in RecordSet: > > + SqlCommand =3D """select Value2 from Inf where BelongsToFi= le =3D > > + (select DISTINCT BelongsToFile from Inf > > + where Value1 =3D > > + (select SourceFileFullPath from Report > > + where GuidValue like '%s' and ItemMode =3D= 'Callback')) > > + and Value1 =3D 'FILE_GUID'""" % Record[0] > > + CallBackSet =3D Db.TblReport.Exec(SqlCommand) > > + if CallBackSet !=3D []: > > + EotGlobalData.gProtocolList[Record[0].lower()] =3D Mod= uleGuid > > + else: > > + EotGlobalData.gProtocolList[Record[0].lower()] =3D Mod= uleGuid > > + > > + def LoadPpi(self, Db, ModuleGuid): > > + SqlCommand =3D """select GuidValue from Report > > + where SourceFileFullPath in > > + (select Value1 from Inf where BelongsToFile = =3D > > + (select BelongsToFile from Inf > > + where Value1 =3D 'FILE_GUID' and Value2 like '= %s' and Model =3D %s) > > + and Model =3D %s) > > + and ItemType =3D 'Ppi' and ItemMode =3D 'Produ= ced'""" \ > > + % (ModuleGuid, 5001, 3007) > > + RecordSet =3D Db.TblReport.Exec(SqlCommand) > > + for Record in RecordSet: > > + EotGlobalData.gPpiList[Record[0].lower()] =3D ModuleGuid > > + > > + def DisPatchDxe(self, Db): > > + IsInstalled =3D False > > + ScheduleList =3D sdict() > > + for FfsID in self.UnDispatchedFfsDict: > > + CouldBeLoaded =3D False > > + DepexString =3D '' > > + FileDepex =3D None > > + Ffs =3D self.UnDispatchedFfsDict[FfsID] > > + if Ffs.Type =3D=3D 0x07: > > + # Get Depex > > + IsFoundDepex =3D False > > + for Section in Ffs.Sections.values(): > > + # Find Depex > > + if Section.Type =3D=3D 0x13: > > + IsFoundDepex =3D True > > + CouldBeLoaded, DepexString, FileDepex =3D self= .ParseDepex(Section._SubImages[4], 'Protocol') > > + break > > + if Section.Type =3D=3D 0x01: > > + CompressSections =3D Section._SubImages[4] > > + for CompressSection in CompressSections.Sectio= ns: > > + if CompressSection.Type =3D=3D 0x13: > > + IsFoundDepex =3D True > > + CouldBeLoaded, DepexString, FileDepex = =3D self.ParseDepex(CompressSection._SubImages[4], > 'Protocol') > > + break > > + if CompressSection.Type =3D=3D 0x02: > > + NewSections =3D CompressSection._SubIm= ages[4] > > + for NewSection in NewSections.Sections= : > > + if NewSection.Type =3D=3D 0x13: > > + IsFoundDepex =3D True > > + CouldBeLoaded, DepexString, Fi= leDepex =3D > self.ParseDepex(NewSection._SubImages[4], 'Protocol') > > + break > > + > > + # Not find Depex > > + if not IsFoundDepex: > > + CouldBeLoaded =3D self.CheckArchProtocol() > > + DepexString =3D '' > > + FileDepex =3D None > > + > > + # Append New Ffs > > + if CouldBeLoaded: > > + IsInstalled =3D True > > + NewFfs =3D self.UnDispatchedFfsDict.pop(FfsID) > > + NewFfs.Depex =3D DepexString > > + if FileDepex is not None: > > + ScheduleList.insert(FileDepex[1], FfsID, NewFf= s, FileDepex[0]) > > + else: > > + ScheduleList[FfsID] =3D NewFfs > > + else: > > + self.UnDispatchedFfsDict[FfsID].Depex =3D DepexStr= ing > > + > > + for FfsID in ScheduleList: > > + NewFfs =3D ScheduleList.pop(FfsID) > > + FfsName =3D 'UnKnown' > > + self.OrderedFfsDict[FfsID] =3D NewFfs > > + self.LoadProtocol(Db, FfsID) > > + > > + SqlCommand =3D """select Value2 from Inf > > + where BelongsToFile =3D (select BelongsToF= ile from Inf where Value1 =3D 'FILE_GUID' and > lower(Value2) =3D lower('%s') and Model =3D %s) > > + and Model =3D %s and Value1=3D'BASE_NAME'"= "" % (FfsID, 5001, 5001) > > + RecordSet =3D Db.TblReport.Exec(SqlCommand) > > + if RecordSet !=3D []: > > + FfsName =3D RecordSet[0][0] > > + > > + if IsInstalled: > > + self.DisPatchDxe(Db) > > + > > + def DisPatchPei(self, Db): > > + IsInstalled =3D False > > + for FfsID in self.UnDispatchedFfsDict: > > + CouldBeLoaded =3D True > > + DepexString =3D '' > > + FileDepex =3D None > > + Ffs =3D self.UnDispatchedFfsDict[FfsID] > > + if Ffs.Type =3D=3D 0x06 or Ffs.Type =3D=3D 0x08: > > + # Get Depex > > + for Section in Ffs.Sections.values(): > > + if Section.Type =3D=3D 0x1B: > > + CouldBeLoaded, DepexString, FileDepex =3D self= .ParseDepex(Section._SubImages[4], 'Ppi') > > + break > > + if Section.Type =3D=3D 0x01: > > + CompressSections =3D Section._SubImages[4] > > + for CompressSection in CompressSections.Sectio= ns: > > + if CompressSection.Type =3D=3D 0x1B: > > + CouldBeLoaded, DepexString, FileDepex = =3D self.ParseDepex(CompressSection._SubImages[4], > 'Ppi') > > + break > > + if CompressSection.Type =3D=3D 0x02: > > + NewSections =3D CompressSection._SubIm= ages[4] > > + for NewSection in NewSections.Sections= : > > + if NewSection.Type =3D=3D 0x1B: > > + CouldBeLoaded, DepexString, Fi= leDepex =3D > self.ParseDepex(NewSection._SubImages[4], 'Ppi') > > + break > > + > > + # Append New Ffs > > + if CouldBeLoaded: > > + IsInstalled =3D True > > + NewFfs =3D self.UnDispatchedFfsDict.pop(FfsID) > > + NewFfs.Depex =3D DepexString > > + self.OrderedFfsDict[FfsID] =3D NewFfs > > + self.LoadPpi(Db, FfsID) > > + else: > > + self.UnDispatchedFfsDict[FfsID].Depex =3D DepexStr= ing > > + > > + if IsInstalled: > > + self.DisPatchPei(Db) > > + > > + > > + def __str__(self): > > + global gIndention > > + gIndention +=3D 4 > > + FvInfo =3D '\n' + ' ' * gIndention > > + FvInfo +=3D "[FV:%s] file_system=3D%s size=3D%x checksum=3D%s= \n" % (self.Name, self.FileSystemGuid, self.Size, self.Checksum) > > + FfsInfo =3D "\n".join([str(self.FfsDict[FfsId]) for FfsId in s= elf.FfsDict]) > > + gIndention -=3D 4 > > + return FvInfo + FfsInfo > > + > > + def _Unpack(self): > > + Size =3D self._LENGTH_.unpack_from(self._BUF_, self._OFF_)[0] > > + self.empty() > > + self.extend(self._BUF_[self._OFF_:self._OFF_+Size]) > > + > > + # traverse the FFS > > + EndOfFv =3D Size > > + FfsStartAddress =3D self.HeaderSize > > + LastFfsObj =3D None > > + while FfsStartAddress < EndOfFv: > > + FfsObj =3D Ffs() > > + FfsObj.frombuffer(self, FfsStartAddress) > > + FfsId =3D repr(FfsObj) > > + if ((self.Attributes & 0x00000800) !=3D 0 and len(FfsObj) = =3D=3D 0xFFFFFF) \ > > + or ((self.Attributes & 0x00000800) =3D=3D 0 and len(Ff= sObj) =3D=3D 0): > > + if LastFfsObj is not None: > > + LastFfsObj.FreeSpace =3D EndOfFv - LastFfsObj._OFF= _ - len(LastFfsObj) > > + else: > > + if FfsId in self.FfsDict: > > + EdkLogger.error("FV", 0, "Duplicate GUID in FFS", > > + ExtraData=3D"\t%s @ %s\n\t%s @ %s"= \ > > + % (FfsObj.Guid, FfsObj.Offset, > > + self.FfsDict[FfsId].Guid, self.= FfsDict[FfsId].Offset)) > > + self.FfsDict[FfsId] =3D FfsObj > > + if LastFfsObj is not None: > > + LastFfsObj.FreeSpace =3D FfsStartAddress - LastFfs= Obj._OFF_ - len(LastFfsObj) > > + > > + FfsStartAddress +=3D len(FfsObj) > > + # > > + # align to next 8-byte aligned address: A =3D (A + 8 - 1) = & (~(8 - 1)) > > + # The next FFS must be at the latest next 8-byte aligned a= ddress > > + # > > + FfsStartAddress =3D (FfsStartAddress + 7) & (~7) > > + LastFfsObj =3D FfsObj > > + > > + def _GetAttributes(self): > > + return self.GetField(self._ATTR_, 0)[0] > > + > > + def _GetSize(self): > > + return self.GetField(self._LENGTH_, 0)[0] > > + > > + def _GetChecksum(self): > > + return self.GetField(self._CHECKSUM_, 0)[0] > > + > > + def _GetHeaderLength(self): > > + return self.GetField(self._HLEN_, 0)[0] > > + > > + def _GetFileSystemGuid(self): > > + return gGuidStringFormat % self.GetField(self._GUID_, 0) > > + > > + Attributes =3D property(_GetAttributes) > > + Size =3D property(_GetSize) > > + Checksum =3D property(_GetChecksum) > > + HeaderSize =3D property(_GetHeaderLength) > > + FileSystemGuid =3D property(_GetFileSystemGuid) > > + > > ## MultipleFv() class > > # > > # A class for Multiple FV > > diff --git a/BaseTools/Source/Python/GenFds/AprioriSection.py b/BaseToo= ls/Source/Python/GenFds/AprioriSection.py > > index 7196f7f2c753..e7b856a1150a 100644 > > --- a/BaseTools/Source/Python/GenFds/AprioriSection.py > > +++ b/BaseTools/Source/Python/GenFds/AprioriSection.py > > @@ -16,28 +16,31 @@ > > # Import Modules > > # > > from __future__ import absolute_import > > -from struct import * > > +from struct import pack > > import Common.LongFilePathOs as os > > from io import BytesIO > > -from . import FfsFileStatement > > +from .FfsFileStatement import FileStatement > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > -from CommonDataClass.FdfClass import AprioriSectionClassObject > > -from Common.StringUtils import * > > +from Common.StringUtils import NormPath > > from Common.Misc import SaveFileOnChange, PathClass > > -from Common import EdkLogger > > -from Common.BuildToolError import * > > +from Common.EdkLogger import error as EdkLoggerError > > +from Common.BuildToolError import RESOURCE_NOT_AVAILABLE > > from Common.DataType import TAB_COMMON > > > > +DXE_APRIORI_GUID =3D "FC510EE7-FFDC-11D4-BD41-0080C73C8881" > > +PEI_APRIORI_GUID =3D "1B45CC0A-156A-428A-AF62-49864DA0E6E6" > > + > > ## process APRIORI file data and generate PEI/DXE APRIORI file > > # > > # > > -class AprioriSection (AprioriSectionClassObject): > > +class AprioriSection (object): > > ## The constructor > > # > > # @param self The object pointer > > # > > def __init__(self): > > - AprioriSectionClassObject.__init__(self) > > + self.DefineVarDict =3D {} > > + self.FfsList =3D [] > > self.AprioriType =3D "" > > > > ## GenFfs() method > > @@ -50,16 +53,16 @@ class AprioriSection (AprioriSectionClassObject): > > # @retval string Generated file name > > # > > def GenFfs (self, FvName, Dict =3D {}, IsMakefile =3D False): > > - DXE_GUID =3D "FC510EE7-FFDC-11D4-BD41-0080C73C8881" > > - PEI_GUID =3D "1B45CC0A-156A-428A-AF62-49864DA0E6E6" > > Buffer =3D BytesIO('') > > - AprioriFileGuid =3D DXE_GUID > > if self.AprioriType =3D=3D "PEI": > > - AprioriFileGuid =3D PEI_GUID > > + AprioriFileGuid =3D PEI_APRIORI_GUID > > + else: > > + AprioriFileGuid =3D DXE_APRIORI_GUID > > + > > OutputAprFilePath =3D os.path.join (GenFdsGlobalVariable.WorkS= paceDir, \ > > GenFdsGlobalVariable.FfsDir,\ > > AprioriFileGuid + FvName) > > - if not os.path.exists(OutputAprFilePath) : > > + if not os.path.exists(OutputAprFilePath): > > os.makedirs(OutputAprFilePath) > > > > OutputAprFileName =3D os.path.join( OutputAprFilePath, \ > > @@ -69,33 +72,30 @@ class AprioriSection (AprioriSectionClassObject): > > > > Dict.update(self.DefineVarDict) > > InfFileName =3D None > > - for FfsObj in self.FfsList : > > + for FfsObj in self.FfsList: > > Guid =3D "" > > - if isinstance(FfsObj, FfsFileStatement.FileStatement): > > + if isinstance(FfsObj, FileStatement): > > Guid =3D FfsObj.NameGuid > > else: > > InfFileName =3D NormPath(FfsObj.InfFileName) > > Arch =3D FfsObj.GetCurrentArch() > > > > - if Arch is not None: > > + if Arch: > > Dict['$(ARCH)'] =3D Arch > > InfFileName =3D GenFdsGlobalVariable.MacroExtend(InfFi= leName, Dict, Arch) > > > > - if Arch is not None: > > + if Arch: > > Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObject= [PathClass(InfFileName, > GenFdsGlobalVariable.WorkSpaceDir), Arch, GenFdsGlobalVariable.TargetName= , GenFdsGlobalVariable.ToolChainTag] > > Guid =3D Inf.Guid > > - > > else: > > Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObject= [PathClass(InfFileName, > GenFdsGlobalVariable.WorkSpaceDir), TAB_COMMON, GenFdsGlobalVariable.Targ= etName, GenFdsGlobalVariable.ToolChainTag] > > Guid =3D Inf.Guid > > > > - self.BinFileList =3D Inf.Module.Binaries > > - if self.BinFileList =3D=3D []: > > - EdkLogger.error("GenFds", RESOURCE_NOT_AVAILAB= LE, > > + if not Inf.Module.Binaries: > > + EdkLoggerError("GenFds", RESOURCE_NOT_AVAILABL= E, > > "INF %s not found in build ARC= H %s!" \ > > % (InfFileName, GenFdsGlobalVa= riable.ArchList)) > > > > - > > GuidPart =3D Guid.split('-') > > Buffer.write(pack('I', long(GuidPart[0], 16))) > > Buffer.write(pack('H', int(GuidPart[1], 16))) > > @@ -123,4 +123,3 @@ class AprioriSection (AprioriSectionClassObject): > > 'EFI_FV_FILETYPE_FREEFORM', Ap= rioriFileGuid, MakefilePath=3DMakefilePath) > > > > return AprFfsFileName > > - > > diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Sour= ce/Python/GenFds/Capsule.py > > index baa6e1dfa2ab..df29c40dbd20 100644 > > --- a/BaseTools/Source/Python/GenFds/Capsule.py > > +++ b/BaseTools/Source/Python/GenFds/Capsule.py > > @@ -16,22 +16,18 @@ > > # Import Modules > > # > > from __future__ import absolute_import > > -from .GenFdsGlobalVariable import GenFdsGlobalVariable > > -from .GenFdsGlobalVariable import FindExtendTool > > +from .GenFdsGlobalVariable import GenFdsGlobalVariable, FindExtendTool > > from CommonDataClass.FdfClass import CapsuleClassObject > > import Common.LongFilePathOs as os > > -import subprocess > > from io import BytesIO > > -from Common.Misc import SaveFileOnChange > > -from Common.Misc import PackRegistryFormatGuid > > +from Common.Misc import SaveFileOnChange, PackRegistryFormatGuid > > import uuid > > from struct import pack > > from Common import EdkLogger > > -from Common.BuildToolError import * > > +from Common.BuildToolError import GENFDS_ERROR > > +from Common.DataType import TAB_LINE_BREAK > > > > - > > -T_CHAR_LF =3D '\n' > > -WIN_CERT_REVISION =3D 0x0200 > > +WIN_CERT_REVISION =3D 0x0200 > > WIN_CERT_TYPE_EFI_GUID =3D 0x0EF1 > > EFI_CERT_TYPE_PKCS7_GUID =3D uuid.UUID('{4aafd29d-68df-49ee-8aa9-347d3= 75665a7}') > > EFI_CERT_TYPE_RSA2048_SHA256_GUID =3D uuid.UUID('{a7717414-c616-4977-9= 420-844712a735bf}') > > @@ -39,7 +35,7 @@ EFI_CERT_TYPE_RSA2048_SHA256_GUID =3D uuid.UUID('{a77= 17414-c616-4977-9420-844712a7 > > ## create inf file describes what goes into capsule and call GenFv to = generate capsule > > # > > # > > -class Capsule (CapsuleClassObject) : > > +class Capsule (CapsuleClassObject): > > ## The constructor > > # > > # @param self The object pointer > > @@ -210,16 +206,16 @@ class Capsule (CapsuleClassObject) : > > return self.GenFmpCapsule() > > > > CapInfFile =3D self.GenCapInf() > > - CapInfFile.writelines("[files]" + T_CHAR_LF) > > + CapInfFile.writelines("[files]" + TAB_LINE_BREAK) > > CapFileList =3D [] > > - for CapsuleDataObj in self.CapsuleDataList : > > + for CapsuleDataObj in self.CapsuleDataList: > > CapsuleDataObj.CapsuleName =3D self.CapsuleName > > FileName =3D CapsuleDataObj.GenCapsuleSubItem() > > CapsuleDataObj.CapsuleName =3D None > > CapFileList.append(FileName) > > CapInfFile.writelines("EFI_FILE_NAME =3D " + \ > > FileName + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > SaveFileOnChange(self.CapInfFileName, CapInfFile.getvalue(), F= alse) > > CapInfFile.close() > > # > > @@ -249,13 +245,13 @@ class Capsule (CapsuleClassObject) : > > self.UiCapsuleName + "_Cap" + '.in= f') > > CapInfFile =3D BytesIO() #open (self.CapInfFileName , 'w+') > > > > - CapInfFile.writelines("[options]" + T_CHAR_LF) > > + CapInfFile.writelines("[options]" + TAB_LINE_BREAK) > > > > for Item in self.TokensDict: > > CapInfFile.writelines("EFI_" + \ > > Item + \ > > ' =3D ' + \ > > self.TokensDict[Item] + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > > > return CapInfFile > > diff --git a/BaseTools/Source/Python/GenFds/CapsuleData.py b/BaseTools/= Source/Python/GenFds/CapsuleData.py > > index 0caba8983d2e..6071e9f4a545 100644 > > --- a/BaseTools/Source/Python/GenFds/CapsuleData.py > > +++ b/BaseTools/Source/Python/GenFds/CapsuleData.py > > @@ -16,7 +16,6 @@ > > # Import Modules > > # > > from __future__ import absolute_import > > -from . import Ffs > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > from io import BytesIO > > from struct import pack > > diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTo= ols/Source/Python/GenFds/CompressSection.py > > index aaaabf84dca8..51f6791fab19 100644 > > --- a/BaseTools/Source/Python/GenFds/CompressSection.py > > +++ b/BaseTools/Source/Python/GenFds/CompressSection.py > > @@ -16,7 +16,7 @@ > > # Import Modules > > # > > from __future__ import absolute_import > > -from .Ffs import Ffs > > +from .Ffs import SectionSuffix > > from . import Section > > import subprocess > > import Common.LongFilePathOs as os > > @@ -86,7 +86,7 @@ class CompressSection (CompressSectionClassObject) : > > ModuleName + \ > > SUP_MODULE_SEC + \ > > SecNum + \ > > - Ffs.SectionSuffix['COMPRESS'] > > + SectionSuffix['COMPRESS'] > > OutputFile =3D os.path.normpath(OutputFile) > > DummyFile =3D OutputFile + '.dummy' > > GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, Inp= utAlign=3DSectAlign, IsMakefile=3DIsMakefile) > > diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/= Source/Python/GenFds/DataSection.py > > index a6387b07c582..28f9b931ca4b 100644 > > --- a/BaseTools/Source/Python/GenFds/DataSection.py > > +++ b/BaseTools/Source/Python/GenFds/DataSection.py > > @@ -19,7 +19,7 @@ from __future__ import absolute_import > > from . import Section > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > import subprocess > > -from .Ffs import Ffs > > +from .Ffs import SectionSuffix > > import Common.LongFilePathOs as os > > from CommonDataClass.FdfClass import DataSectionClassObject > > from Common.Misc import PeImageClass > > @@ -121,7 +121,7 @@ class DataSection (DataSectionClassObject): > > ) > > self.SectFileName =3D TeFile > > > > - OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODU= LE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType)) > > + OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODU= LE_SEC + SecNum + SectionSuffix.get(self.SecType)) > > OutputFile =3D os.path.normpath(OutputFile) > > GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFil= eName], Section.Section.SectionType.get(self.SecType), > IsMakefile =3D IsMakefile) > > FileList =3D [OutputFile] > > diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools= /Source/Python/GenFds/DepexSection.py > > index b2d123bfc045..78efc18816e8 100644 > > --- a/BaseTools/Source/Python/GenFds/DepexSection.py > > +++ b/BaseTools/Source/Python/GenFds/DepexSection.py > > @@ -18,8 +18,6 @@ > > from __future__ import absolute_import > > from . import Section > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > -import subprocess > > -from .Ffs import Ffs > > import Common.LongFilePathOs as os > > from CommonDataClass.FdfClass import DepexSectionClassObject > > from AutoGen.GenDepex import DependencyExpression > > @@ -46,9 +44,8 @@ class DepexSection (DepexSectionClassObject): > > Ge= nFdsGlobalVariable.TargetName, > > Ge= nFdsGlobalVariable.ToolChainTag) > > for Inf in GenFdsGlobalVariable.FdfParser.Profile.InfList: > > - ModuleFile =3D PathClass(Inf, GenFdsGlobalVariable.Wor= kSpaceDir) > > ModuleData =3D GenFdsGlobalVariable.WorkSpace.BuildObj= ect[ > > - ModuleFile= , > > + PathClass(= Inf, GenFdsGlobalVariable.WorkSpaceDir), > > Arch, > > GenFdsGlob= alVariable.TargetName, > > GenFdsGlob= alVariable.ToolChainTag > > diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/S= ource/Python/GenFds/EfiSection.py > > index 623b77d27427..f8573b5c7d1b 100644 > > --- a/BaseTools/Source/Python/GenFds/EfiSection.py > > +++ b/BaseTools/Source/Python/GenFds/EfiSection.py > > @@ -20,7 +20,7 @@ from struct import * > > from . import Section > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > import subprocess > > -from .Ffs import Ffs > > +from .Ffs import SectionSuffix > > import Common.LongFilePathOs as os > > from CommonDataClass.FdfClass import EfiSectionClassObject > > from Common import EdkLogger > > @@ -124,7 +124,7 @@ class EfiSection (EfiSectionClassObject): > > BuildNumTuple =3D tuple() > > > > Num =3D SecNum > > - OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > Ffs.SectionSuffix.get(SectionType)) > > + OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > SectionSuffix.get(SectionType)) > > GenFdsGlobalVariable.GenerateSection(OutputFile, [], '= EFI_SECTION_VERSION', > > #Ui=3DStringData, > > Ver=3DBuildNum, > > @@ -135,7 +135,7 @@ class EfiSection (EfiSectionClassObject): > > for File in FileList: > > Index =3D Index + 1 > > Num =3D '%s.%d' %(SecNum, Index) > > - OutputFile =3D os.path.join(OutputPath, ModuleName= + SUP_MODULE_SEC + Num + > Ffs.SectionSuffix.get(SectionType)) > > + OutputFile =3D os.path.join(OutputPath, ModuleName= + SUP_MODULE_SEC + Num + > SectionSuffix.get(SectionType)) > > f =3D open(File, 'r') > > VerString =3D f.read() > > f.close() > > @@ -164,7 +164,7 @@ class EfiSection (EfiSectionClassObject): > > else: > > EdkLogger.error("GenFds", GENFDS_ERROR, "File:= %s miss Version Section value" %InfFileName) > > Num =3D SecNum > > - OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > Ffs.SectionSuffix.get(SectionType)) > > + OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > SectionSuffix.get(SectionType)) > > GenFdsGlobalVariable.GenerateSection(OutputFile, [], '= EFI_SECTION_VERSION', > > #Ui=3DVerString, > > Ver=3DBuildNum, > > @@ -185,7 +185,7 @@ class EfiSection (EfiSectionClassObject): > > Num =3D SecNum > > if IsMakefile and StringData =3D=3D ModuleNameStr: > > StringData =3D "$(MODULE_NAME)" > > - OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > Ffs.SectionSuffix.get(SectionType)) > > + OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > SectionSuffix.get(SectionType)) > > GenFdsGlobalVariable.GenerateSection(OutputFile, [], '= EFI_SECTION_USER_INTERFACE', > > Ui=3DStringData, = IsMakefile=3DIsMakefile) > > OutputFileList.append(OutputFile) > > @@ -194,7 +194,7 @@ class EfiSection (EfiSectionClassObject): > > for File in FileList: > > Index =3D Index + 1 > > Num =3D '%s.%d' %(SecNum, Index) > > - OutputFile =3D os.path.join(OutputPath, ModuleName= + SUP_MODULE_SEC + Num + > Ffs.SectionSuffix.get(SectionType)) > > + OutputFile =3D os.path.join(OutputPath, ModuleName= + SUP_MODULE_SEC + Num + > SectionSuffix.get(SectionType)) > > f =3D open(File, 'r') > > UiString =3D f.read() > > f.close() > > @@ -218,7 +218,7 @@ class EfiSection (EfiSectionClassObject): > > Num =3D SecNum > > if IsMakefile and StringData =3D=3D ModuleNameStr: > > StringData =3D "$(MODULE_NAME)" > > - OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > Ffs.SectionSuffix.get(SectionType)) > > + OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + str(Num) + > SectionSuffix.get(SectionType)) > > GenFdsGlobalVariable.GenerateSection(OutputFile, [], '= EFI_SECTION_USER_INTERFACE', > > Ui=3DStringData, = IsMakefile=3DIsMakefile) > > OutputFileList.append(OutputFile) > > @@ -239,7 +239,7 @@ class EfiSection (EfiSectionClassObject): > > """ Copy Map file to FFS output path """ > > Index =3D Index + 1 > > Num =3D '%s.%d' %(SecNum, Index) > > - OutputFile =3D os.path.join( OutputPath, ModuleNam= e + SUP_MODULE_SEC + Num + > Ffs.SectionSuffix.get(SectionType)) > > + OutputFile =3D os.path.join( OutputPath, ModuleNam= e + SUP_MODULE_SEC + Num + > SectionSuffix.get(SectionType)) > > File =3D GenFdsGlobalVariable.MacroExtend(File, Di= ct) > > > > #Get PE Section alignment when align is set to AUT= O > > diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/So= urce/Python/GenFds/FdfParser.py > > index 63687e98bb31..62bf9f14012a 100644 > > --- a/BaseTools/Source/Python/GenFds/FdfParser.py > > +++ b/BaseTools/Source/Python/GenFds/FdfParser.py > > @@ -18,79 +18,66 @@ > > # > > from __future__ import print_function > > from __future__ import absolute_import > > -import re > > +from re import compile, DOTALL > > +from string import hexdigits > > +from uuid import UUID > > > > -from . import Fd > > -from . import Region > > -from . import Fv > > -from . import AprioriSection > > -from . import FfsInfStatement > > -from . import FfsFileStatement > > -from . import VerSection > > -from . import UiSection > > -from . import FvImageSection > > -from . import DataSection > > -from . import DepexSection > > -from . import CompressSection > > -from . import GuidSection > > -from . import Capsule > > -from . import CapsuleData > > -from . import Rule > > -from . import RuleComplexFile > > -from . import RuleSimpleFile > > -from . import EfiSection > > -from . import Vtf > > -from . import ComponentStatement > > -from . import OptionRom > > -from . import OptRomInfStatement > > -from . import OptRomFileStatement > > -import string > > - > > -from .GenFdsGlobalVariable import GenFdsGlobalVariable > > from Common.BuildToolError import * > > from Common import EdkLogger > > -from Common.Misc import PathClass > > -from Common.StringUtils import NormPath > > -import Common.GlobalData as GlobalData > > -from Common.Expression import * > > +from Common.Misc import PathClass, tdict > > +from Common.StringUtils import NormPath, ReplaceMacro > > from Common import GlobalData > > +from Common.Expression import * > > from Common.DataType import * > > -from Common.StringUtils import ReplaceMacro > > -import uuid > > -from Common.Misc import tdict > > from Common.MultipleWorkspace import MultipleWorkspace as mws > > import Common.LongFilePathOs as os > > from Common.LongFilePathSupport import OpenLongFilePath as open > > -from .Capsule import EFI_CERT_TYPE_PKCS7_GUID > > -from .Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID > > from Common.RangeExpression import RangeExpression > > from collections import OrderedDict > > > > -##define T_CHAR_SPACE ' ' > > -##define T_CHAR_NULL '\0' > > -##define T_CHAR_CR '\r' > > -##define T_CHAR_TAB '\t' > > -##define T_CHAR_LF '\n' > > -##define T_CHAR_SLASH '/' > > -##define T_CHAR_BACKSLASH '\\' > > -##define T_CHAR_DOUBLE_QUOTE '\"' > > -##define T_CHAR_SINGLE_QUOTE '\'' > > -##define T_CHAR_STAR '*' > > -##define T_CHAR_HASH '#' > > +from .Fd import FD > > +from .Region import Region > > +from .Fv import FV > > +from .AprioriSection import AprioriSection > > +from .FfsInfStatement import FfsInfStatement > > +from .FfsFileStatement import FileStatement > > +from .VerSection import VerSection > > +from .UiSection import UiSection > > +from .FvImageSection import FvImageSection > > +from .DataSection import DataSection > > +from .DepexSection import DepexSection > > +from .CompressSection import CompressSection > > +from .GuidSection import GuidSection > > +from .Capsule import EFI_CERT_TYPE_PKCS7_GUID, EFI_CERT_TYPE_RSA2048_S= HA256_GUID, Capsule > > +from .CapsuleData import CapsuleFfs, CapsulePayload, CapsuleFv, Capsul= eFd, CapsuleAnyFile, CapsuleAfile > > +from .RuleComplexFile import RuleComplexFile > > +from .RuleSimpleFile import RuleSimpleFile > > +from .EfiSection import EfiSection > > +from .Vtf import Vtf > > +from .ComponentStatement import ComponentStatement > > +from .OptionRom import OPTIONROM > > +from .OptRomInfStatement import OptRomInfStatement, OverrideAttribs > > +from .OptRomFileStatement import OptRomFileStatement > > +from .GenFdsGlobalVariable import GenFdsGlobalVariable > > > > -(T_CHAR_SPACE, T_CHAR_NULL, T_CHAR_CR, T_CHAR_TAB, T_CHAR_LF, T_CHAR_S= LASH, \ > > -T_CHAR_BACKSLASH, T_CHAR_DOUBLE_QUOTE, T_CHAR_SINGLE_QUOTE, T_CHAR_STA= R, T_CHAR_HASH) =3D \ > > -(' ', '\0', '\r', '\t', '\n', '/', '\\', '\"', '\'', '*', '#') > > +T_CHAR_CR =3D '\r' > > +T_CHAR_TAB =3D '\t' > > +T_CHAR_DOUBLE_QUOTE =3D '\"' > > +T_CHAR_SINGLE_QUOTE =3D '\'' > > +T_CHAR_STAR =3D '*' > > > > -SEPERATOR_TUPLE =3D ('=3D', '|', ',', '{', '}') > > +SEPARATORS =3D {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{'= , '}'} > > +ALIGNMENTS =3D {"Auto", "8", "16", "32", "64", "128", "512", "1K", "4K= ", "32K", "64K", "128K", > > + "256K", "512K", "1M", "2M", "4M", = "8M", "16M"} > > +ALIGNMENT_NOAUTO =3D ALIGNMENTS - {"Auto"} > > > > -RegionSizePattern =3D re.compile("\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\= s*\|\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*") > > -RegionSizeGuidPattern =3D re.compile("\s*(?P\w+\.\w+[\.\w\[\]]*)= \s*\|\s*(?P\w+\.\w+[\.\w\[\]]*)\s*") > > -RegionOffsetPcdPattern =3D re.compile("\s*(?P\w+\.\w+[\.\w\[\]]*= )\s*$") > > -ShortcutPcdPattern =3D re.compile("\s*\w+\s*=3D\s*(?P(?:0x|0X)?= [a-fA-F0-9]+)\s*\|\s*(?P\w+\.\w+)\s*") > > -BaseAddrValuePattern =3D re.compile('^0[xX][0-9a-fA-F]+') > > -FileExtensionPattern =3D re.compile(r'([a-zA-Z][a-zA-Z0-9]*)') > > -TokenFindPattern =3D > re.compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CH= AIN_TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\)|\*)') > > +RegionSizePattern =3D compile("\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*\= |\s*(?P(?:0x|0X)?[a-fA-F0-9]+)\s*") > > +RegionSizeGuidPattern =3D compile("\s*(?P\w+\.\w+[\.\w\[\]]*)\s*= \|\s*(?P\w+\.\w+[\.\w\[\]]*)\s*") > > +RegionOffsetPcdPattern =3D compile("\s*(?P\w+\.\w+[\.\w\[\]]*)\s= *$") > > +ShortcutPcdPattern =3D compile("\s*\w+\s*=3D\s*(?P(?:0x|0X)?[a-= fA-F0-9]+)\s*\|\s*(?P\w+\.\w+)\s*") > > +BaseAddrValuePattern =3D compile('^0[xX][0-9a-fA-F]+') > > +FileExtensionPattern =3D compile(r'([a-zA-Z][a-zA-Z0-9]*)') > > +TokenFindPattern =3D > compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHAIN= _TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\)|\*)') > > AllIncludeFileList =3D [] > > > > # Get the closest parent > > @@ -109,7 +96,6 @@ def IsValidInclude (File, Line): > > return True > > > > def GetRealFileLine (File, Line): > > - > > InsertedLines =3D 0 > > for Profile in AllIncludeFileList: > > if Profile.IsLineInFile(Line): > > @@ -121,7 +107,7 @@ def GetRealFileLine (File, Line): > > > > ## The exception class that used to report error messages when parsing= FDF > > # > > -# Currently the "ToolName" is set to be "FDF Parser". > > +# Currently the "ToolName" is set to be "FdfParser". > > # > > class Warning (Exception): > > ## The constructor > > @@ -132,7 +118,6 @@ class Warning (Exception): > > # @param Line The Line number that error occurs > > # > > def __init__(self, Str, File =3D None, Line =3D None): > > - > > FileLineTuple =3D GetRealFileLine(File, Line) > > self.FileName =3D FileLineTuple[0] > > self.LineNumber =3D FileLineTuple[1] > > @@ -147,7 +132,7 @@ class Warning (Exception): > > # > > # May raise Exception when opening file. > > # > > -class IncludeFileProfile : > > +class IncludeFileProfile: > > ## The constructor > > # > > # @param self The object pointer > > @@ -157,16 +142,11 @@ class IncludeFileProfile : > > self.FileName =3D FileName > > self.FileLinesList =3D [] > > try: > > - fsock =3D open(FileName, "rb", 0) > > - try: > > + with open(FileName, "rb", 0) as fsock: > > self.FileLinesList =3D fsock.readlines() > > for index, line in enumerate(self.FileLinesList): > > - if not line.endswith('\n'): > > - self.FileLinesList[index] +=3D '\n' > > - > > - finally: > > - fsock.close() > > - > > + if not line.endswith(TAB_LINE_BREAK): > > + self.FileLinesList[index] +=3D TAB_LINE_BREAK > > except: > > EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraData= =3DFileName) > > > > @@ -209,7 +189,7 @@ class IncludeFileProfile : > > # > > # May raise Exception when opening file. > > # > > -class FileProfile : > > +class FileProfile: > > ## The constructor > > # > > # @param self The object pointer > > @@ -218,11 +198,8 @@ class FileProfile : > > def __init__(self, FileName): > > self.FileLinesList =3D [] > > try: > > - fsock =3D open(FileName, "rb", 0) > > - try: > > + with open(FileName, "rb", 0) as fsock: > > self.FileLinesList =3D fsock.readlines() > > - finally: > > - fsock.close() > > > > except: > > EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraData= =3DFileName) > > @@ -266,41 +243,37 @@ class FdfParser: > > self.CurrentOffsetWithinLine =3D 0 > > self.CurrentFdName =3D None > > self.CurrentFvName =3D None > > - self.__Token =3D "" > > - self.__SkippedChars =3D "" > > + self._Token =3D "" > > + self._SkippedChars =3D "" > > GlobalData.gFdfParser =3D self > > > > # Used to section info > > - self.__CurSection =3D [] > > + self._CurSection =3D [] > > # Key: [section name, UI name, arch] > > - # Value: {MACRO_NAME : MACRO_VALUE} > > - self.__MacroDict =3D tdict(True, 3) > > - self.__PcdDict =3D OrderedDict() > > + # Value: {MACRO_NAME: MACRO_VALUE} > > + self._MacroDict =3D tdict(True, 3) > > + self._PcdDict =3D OrderedDict() > > > > - self.__WipeOffArea =3D [] > > + self._WipeOffArea =3D [] > > if GenFdsGlobalVariable.WorkSpaceDir =3D=3D '': > > GenFdsGlobalVariable.WorkSpaceDir =3D os.getenv("WORKSPACE= ") > > > > - ## __SkipWhiteSpace() method > > + ## _SkipWhiteSpace() method > > # > > - # Skip white spaces from current char, return number of chars sk= ipped > > + # Skip white spaces from current char. > > # > > # @param self The object pointer > > - # @retval Count The number of chars skipped > > # > > - def __SkipWhiteSpace(self): > > - Count =3D 0 > > - while not self.__EndOfFile(): > > - Count +=3D 1 > > - if self.__CurrentChar() in (T_CHAR_NULL, T_CHAR_CR, T_CHAR= _LF, T_CHAR_SPACE, T_CHAR_TAB): > > - self.__SkippedChars +=3D str(self.__CurrentChar()) > > - self.__GetOneChar() > > - > > + def _SkipWhiteSpace(self): > > + while not self._EndOfFile(): > > + if self._CurrentChar() in (TAB_PRINTCHAR_NUL, T_CHAR_CR, T= AB_LINE_BREAK, TAB_SPACE_SPLIT, T_CHAR_TAB): > > + self._SkippedChars +=3D str(self._CurrentChar()) > > + self._GetOneChar() > > else: > > - Count =3D Count - 1 > > - return Count > > + return > > + return > > > > - ## __EndOfFile() method > > + ## _EndOfFile() method > > # > > # Judge current buffer pos is at file end > > # > > @@ -308,17 +281,16 @@ class FdfParser: > > # @retval True Current File buffer position is at file en= d > > # @retval False Current File buffer position is NOT at fil= e end > > # > > - def __EndOfFile(self): > > + def _EndOfFile(self): > > NumberOfLines =3D len(self.Profile.FileLinesList) > > SizeOfLastLine =3D len(self.Profile.FileLinesList[-1]) > > if self.CurrentLineNumber =3D=3D NumberOfLines and self.Curren= tOffsetWithinLine >=3D SizeOfLastLine - 1: > > return True > > - elif self.CurrentLineNumber > NumberOfLines: > > + if self.CurrentLineNumber > NumberOfLines: > > return True > > - else: > > - return False > > + return False > > > > - ## __EndOfLine() method > > + ## _EndOfLine() method > > # > > # Judge current buffer pos is at line end > > # > > @@ -326,14 +298,13 @@ class FdfParser: > > # @retval True Current File buffer position is at line en= d > > # @retval False Current File buffer position is NOT at lin= e end > > # > > - def __EndOfLine(self): > > + def _EndOfLine(self): > > if self.CurrentLineNumber > len(self.Profile.FileLinesList): > > return True > > SizeOfCurrentLine =3D len(self.Profile.FileLinesList[self.Curr= entLineNumber - 1]) > > if self.CurrentOffsetWithinLine >=3D SizeOfCurrentLine: > > return True > > - else: > > - return False > > + return False > > > > ## Rewind() method > > # > > @@ -347,7 +318,7 @@ class FdfParser: > > self.CurrentLineNumber =3D DestLine > > self.CurrentOffsetWithinLine =3D DestOffset > > > > - ## __UndoOneChar() method > > + ## _UndoOneChar() method > > # > > # Go back one char in the file buffer > > # > > @@ -355,80 +326,78 @@ class FdfParser: > > # @retval True Successfully go back one char > > # @retval False Not able to go back one char as file begin= ning reached > > # > > - def __UndoOneChar(self): > > - > > + def _UndoOneChar(self): > > if self.CurrentLineNumber =3D=3D 1 and self.CurrentOffsetWithi= nLine =3D=3D 0: > > return False > > elif self.CurrentOffsetWithinLine =3D=3D 0: > > self.CurrentLineNumber -=3D 1 > > - self.CurrentOffsetWithinLine =3D len(self.__CurrentLine())= - 1 > > + self.CurrentOffsetWithinLine =3D len(self._CurrentLine()) = - 1 > > else: > > self.CurrentOffsetWithinLine -=3D 1 > > return True > > > > - ## __GetOneChar() method > > + ## _GetOneChar() method > > # > > # Move forward one char in the file buffer > > # > > # @param self The object pointer > > # > > - def __GetOneChar(self): > > + def _GetOneChar(self): > > if self.CurrentOffsetWithinLine =3D=3D len(self.Profile.FileLi= nesList[self.CurrentLineNumber - 1]) - 1: > > self.CurrentLineNumber +=3D 1 > > self.CurrentOffsetWithinLine =3D 0 > > else: > > self.CurrentOffsetWithinLine +=3D 1 > > > > - ## __CurrentChar() method > > + ## _CurrentChar() method > > # > > # Get the char pointed to by the file buffer pointer > > # > > # @param self The object pointer > > # @retval Char Current char > > # > > - def __CurrentChar(self): > > + def _CurrentChar(self): > > return self.Profile.FileLinesList[self.CurrentLineNumber - 1][= self.CurrentOffsetWithinLine] > > > > - ## __NextChar() method > > + ## _NextChar() method > > # > > # Get the one char pass the char pointed to by the file buffer p= ointer > > # > > # @param self The object pointer > > # @retval Char Next char > > # > > - def __NextChar(self): > > + def _NextChar(self): > > if self.CurrentOffsetWithinLine =3D=3D len(self.Profile.FileLi= nesList[self.CurrentLineNumber - 1]) - 1: > > return self.Profile.FileLinesList[self.CurrentLineNumber][= 0] > > - else: > > - return self.Profile.FileLinesList[self.CurrentLineNumber -= 1][self.CurrentOffsetWithinLine + 1] > > + return self.Profile.FileLinesList[self.CurrentLineNumber - 1][= self.CurrentOffsetWithinLine + 1] > > > > - ## __SetCurrentCharValue() method > > + ## _SetCurrentCharValue() method > > # > > # Modify the value of current char > > # > > # @param self The object pointer > > # @param Value The new value of current char > > # > > - def __SetCurrentCharValue(self, Value): > > + def _SetCurrentCharValue(self, Value): > > self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.Cu= rrentOffsetWithinLine] =3D Value > > > > - ## __CurrentLine() method > > + ## _CurrentLine() method > > # > > # Get the list that contains current line contents > > # > > # @param self The object pointer > > # @retval List current line contents > > # > > - def __CurrentLine(self): > > + def _CurrentLine(self): > > return self.Profile.FileLinesList[self.CurrentLineNumber - 1] > > > > - def __StringToList(self): > > + def _StringToList(self): > > self.Profile.FileLinesList =3D [list(s) for s in self.Profile.= FileLinesList] > > if not self.Profile.FileLinesList: > > EdkLogger.error('FdfParser', FILE_READ_FAILURE, 'The file = is empty!', File=3Dself.FileName) > > self.Profile.FileLinesList[-1].append(' ') > > > > - def __ReplaceFragment(self, StartPos, EndPos, Value =3D ' '): > > + def _ReplaceFragment(self, StartPos, EndPos, Value =3D ' '): > > if StartPos[0] =3D=3D EndPos[0]: > > Offset =3D StartPos[1] > > while Offset <=3D EndPos[1]: > > @@ -437,14 +406,14 @@ class FdfParser: > > return > > > > Offset =3D StartPos[1] > > - while self.Profile.FileLinesList[StartPos[0]][Offset] not in (= '\r', '\n'): > > + while self.Profile.FileLinesList[StartPos[0]][Offset] not in (= T_CHAR_CR, TAB_LINE_BREAK): > > self.Profile.FileLinesList[StartPos[0]][Offset] =3D Value > > Offset +=3D 1 > > > > Line =3D StartPos[0] > > while Line < EndPos[0]: > > Offset =3D 0 > > - while self.Profile.FileLinesList[Line][Offset] not in ('\r= ', '\n'): > > + while self.Profile.FileLinesList[Line][Offset] not in (T_C= HAR_CR, TAB_LINE_BREAK): > > self.Profile.FileLinesList[Line][Offset] =3D Value > > Offset +=3D 1 > > Line +=3D 1 > > @@ -454,45 +423,29 @@ class FdfParser: > > self.Profile.FileLinesList[EndPos[0]][Offset] =3D Value > > Offset +=3D 1 > > > > - > > - def __GetMacroName(self): > > - if not self.__GetNextToken(): > > - raise Warning("expected Macro name", self.FileName, self.C= urrentLineNumber) > > - MacroName =3D self.__Token > > - NotFlag =3D False > > - if MacroName.startswith('!'): > > - NotFlag =3D True > > - MacroName =3D MacroName[1:].strip() > > - > > - if not MacroName.startswith('$(') or not MacroName.endswith(')= '): > > - raise Warning("Macro name expected(Please use '$(%(Token)s= )' if '%(Token)s' is a macro.)" % {"Token" : MacroName}, > > - self.FileName, self.CurrentLineNumber) > > - MacroName =3D MacroName[2:-1] > > - return MacroName, NotFlag > > - > > - def __SetMacroValue(self, Macro, Value): > > - if not self.__CurSection: > > + def _SetMacroValue(self, Macro, Value): > > + if not self._CurSection: > > return > > > > MacroDict =3D {} > > - if not self.__MacroDict[self.__CurSection[0], self.__CurSectio= n[1], self.__CurSection[2]]: > > - self.__MacroDict[self.__CurSection[0], self.__CurSection[1= ], self.__CurSection[2]] =3D MacroDict > > + if not self._MacroDict[self._CurSection[0], self._CurSection[1= ], self._CurSection[2]]: > > + self._MacroDict[self._CurSection[0], self._CurSection[1], = self._CurSection[2]] =3D MacroDict > > else: > > - MacroDict =3D self.__MacroDict[self.__CurSection[0], self.= __CurSection[1], self.__CurSection[2]] > > + MacroDict =3D self._MacroDict[self._CurSection[0], self._C= urSection[1], self._CurSection[2]] > > MacroDict[Macro] =3D Value > > > > - def __GetMacroValue(self, Macro): > > + def _GetMacroValue(self, Macro): > > # Highest priority > > if Macro in GlobalData.gCommandLineDefines: > > return GlobalData.gCommandLineDefines[Macro] > > if Macro in GlobalData.gGlobalDefines: > > return GlobalData.gGlobalDefines[Macro] > > > > - if self.__CurSection: > > - MacroDict =3D self.__MacroDict[ > > - self.__CurSection[0], > > - self.__CurSection[1], > > - self.__CurSection[2] > > + if self._CurSection: > > + MacroDict =3D self._MacroDict[ > > + self._CurSection[0], > > + self._CurSection[1], > > + self._CurSection[2] > > ] > > if MacroDict and Macro in MacroDict: > > return MacroDict[Macro] > > @@ -502,7 +455,7 @@ class FdfParser: > > return GlobalData.gPlatformDefines[Macro] > > return None > > > > - def __SectionHeaderParser(self, Section): > > + def _SectionHeaderParser(self, Section): > > # [Defines] > > # [FD.UiName]: use dummy instead if UI name is optional > > # [FV.UiName] > > @@ -510,25 +463,25 @@ class FdfParser: > > # [Rule]: don't take rule section into account, macro is not a= llowed in this section > > # [VTF.arch.UiName, arch] > > # [OptionRom.DriverName] > > - self.__CurSection =3D [] > > - Section =3D Section.strip()[1:-1].upper().replace(' ', '').str= ip('.') > > - ItemList =3D Section.split('.') > > + self._CurSection =3D [] > > + Section =3D Section.strip()[1:-1].upper().replace(' ', '').str= ip(TAB_SPLIT) > > + ItemList =3D Section.split(TAB_SPLIT) > > Item =3D ItemList[0] > > if Item =3D=3D '' or Item =3D=3D 'RULE': > > return > > > > if Item =3D=3D TAB_COMMON_DEFINES.upper(): > > - self.__CurSection =3D [TAB_COMMON, TAB_COMMON, TAB_COMMON] > > + self._CurSection =3D [TAB_COMMON, TAB_COMMON, TAB_COMMON] > > elif Item =3D=3D 'VTF' and len(ItemList) =3D=3D 3: > > UiName =3D ItemList[2] > > - Pos =3D UiName.find(',') > > + Pos =3D UiName.find(TAB_COMMA_SPLIT) > > if Pos !=3D -1: > > UiName =3D UiName[:Pos] > > - self.__CurSection =3D ['VTF', UiName, ItemList[1]] > > + self._CurSection =3D ['VTF', UiName, ItemList[1]] > > elif len(ItemList) > 1: > > - self.__CurSection =3D [ItemList[0], ItemList[1], TAB_COMMO= N] > > + self._CurSection =3D [ItemList[0], ItemList[1], TAB_COMMON= ] > > elif len(ItemList) > 0: > > - self.__CurSection =3D [ItemList[0], 'DUMMY', TAB_COMMON] > > + self._CurSection =3D [ItemList[0], 'DUMMY', TAB_COMMON] > > > > ## PreprocessFile() method > > # > > @@ -540,7 +493,6 @@ class FdfParser: > > # @param self The object pointer > > # > > def PreprocessFile(self): > > - > > self.Rewind() > > InComment =3D False > > DoubleSlashComment =3D False > > @@ -548,12 +500,12 @@ class FdfParser: > > # HashComment in quoted string " " is ignored. > > InString =3D False > > > > - while not self.__EndOfFile(): > > + while not self._EndOfFile(): > > > > - if self.__CurrentChar() =3D=3D T_CHAR_DOUBLE_QUOTE and not= InComment: > > + if self._CurrentChar() =3D=3D T_CHAR_DOUBLE_QUOTE and not = InComment: > > InString =3D not InString > > # meet new line, then no longer in a comment for // and '#= ' > > - if self.__CurrentChar() =3D=3D T_CHAR_LF: > > + if self._CurrentChar() =3D=3D TAB_LINE_BREAK: > > self.CurrentLineNumber +=3D 1 > > self.CurrentOffsetWithinLine =3D 0 > > if InComment and DoubleSlashComment: > > @@ -563,33 +515,33 @@ class FdfParser: > > InComment =3D False > > HashComment =3D False > > # check for */ comment end > > - elif InComment and not DoubleSlashComment and not HashComm= ent and self.__CurrentChar() =3D=3D T_CHAR_STAR and > self.__NextChar() =3D=3D T_CHAR_SLASH: > > - self.__SetCurrentCharValue(T_CHAR_SPACE) > > - self.__GetOneChar() > > - self.__SetCurrentCharValue(T_CHAR_SPACE) > > - self.__GetOneChar() > > + elif InComment and not DoubleSlashComment and not HashComm= ent and self._CurrentChar() =3D=3D T_CHAR_STAR and > self._NextChar() =3D=3D TAB_BACK_SLASH: > > + self._SetCurrentCharValue(TAB_SPACE_SPLIT) > > + self._GetOneChar() > > + self._SetCurrentCharValue(TAB_SPACE_SPLIT) > > + self._GetOneChar() > > InComment =3D False > > # set comments to spaces > > elif InComment: > > - self.__SetCurrentCharValue(T_CHAR_SPACE) > > - self.__GetOneChar() > > + self._SetCurrentCharValue(TAB_SPACE_SPLIT) > > + self._GetOneChar() > > # check for // comment > > - elif self.__CurrentChar() =3D=3D T_CHAR_SLASH and self.__N= extChar() =3D=3D T_CHAR_SLASH and not self.__EndOfLine(): > > + elif self._CurrentChar() =3D=3D TAB_BACK_SLASH and self._N= extChar() =3D=3D TAB_BACK_SLASH and not self._EndOfLine(): > > InComment =3D True > > DoubleSlashComment =3D True > > # check for '#' comment > > - elif self.__CurrentChar() =3D=3D T_CHAR_HASH and not self.= __EndOfLine() and not InString: > > + elif self._CurrentChar() =3D=3D TAB_COMMENT_SPLIT and not = self._EndOfLine() and not InString: > > InComment =3D True > > HashComment =3D True > > # check for /* comment start > > - elif self.__CurrentChar() =3D=3D T_CHAR_SLASH and self.__N= extChar() =3D=3D T_CHAR_STAR: > > - self.__SetCurrentCharValue( T_CHAR_SPACE) > > - self.__GetOneChar() > > - self.__SetCurrentCharValue( T_CHAR_SPACE) > > - self.__GetOneChar() > > + elif self._CurrentChar() =3D=3D TAB_BACK_SLASH and self._N= extChar() =3D=3D T_CHAR_STAR: > > + self._SetCurrentCharValue(TAB_SPACE_SPLIT) > > + self._GetOneChar() > > + self._SetCurrentCharValue(TAB_SPACE_SPLIT) > > + self._GetOneChar() > > InComment =3D True > > else: > > - self.__GetOneChar() > > + self._GetOneChar() > > > > # restore from ListOfList to ListOfString > > self.Profile.FileLinesList =3D ["".join(list) for list in self= .Profile.FileLinesList] > > @@ -606,30 +558,30 @@ class FdfParser: > > # nested include support > > Processed =3D False > > MacroDict =3D {} > > - while self.__GetNextToken(): > > + while self._GetNextToken(): > > > > - if self.__Token =3D=3D 'DEFINE': > > - if not self.__GetNextToken(): > > + if self._Token =3D=3D TAB_DEFINE: > > + if not self._GetNextToken(): > > raise Warning("expected Macro name", self.FileName= , self.CurrentLineNumber) > > - Macro =3D self.__Token > > - if not self.__IsToken( "=3D"): > > + Macro =3D self._Token > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, sel= f.CurrentLineNumber) > > - Value =3D self.__GetExpression() > > + Value =3D self._GetExpression() > > MacroDict[Macro] =3D Value > > > > - elif self.__Token =3D=3D '!include': > > + elif self._Token =3D=3D TAB_INCLUDE: > > Processed =3D True > > IncludeLine =3D self.CurrentLineNumber > > - IncludeOffset =3D self.CurrentOffsetWithinLine - len('= !include') > > - if not self.__GetNextToken(): > > + IncludeOffset =3D self.CurrentOffsetWithinLine - len(T= AB_INCLUDE) > > + if not self._GetNextToken(): > > raise Warning("expected include file name", self.F= ileName, self.CurrentLineNumber) > > - IncFileName =3D self.__Token > > + IncFileName =3D self._Token > > PreIndex =3D 0 > > StartPos =3D IncFileName.find('$(', PreIndex) > > EndPos =3D IncFileName.find(')', StartPos+2) > > while StartPos !=3D -1 and EndPos !=3D -1: > > - Macro =3D IncFileName[StartPos+2 : EndPos] > > - MacroVal =3D self.__GetMacroValue(Macro) > > + Macro =3D IncFileName[StartPos+2: EndPos] > > + MacroVal =3D self._GetMacroValue(Macro) > > if not MacroVal: > > if Macro in MacroDict: > > MacroVal =3D MacroDict[Macro] > > @@ -686,9 +638,9 @@ class FdfParser: > > IncFileProfile.Level =3D ParentProfile.Level + 1 > > IncFileProfile.InsertStartLineNumber =3D InsertAtLine = + 1 > > # deal with remaining portions after "!include filenam= e", if exists. > > - if self.__GetNextToken(): > > + if self._GetNextToken(): > > if self.CurrentLineNumber =3D=3D CurrentLine: > > - RemainingLine =3D self.__CurrentLine()[Current= Offset:] > > + RemainingLine =3D self._CurrentLine()[CurrentO= ffset:] > > self.Profile.FileLinesList.insert(self.Current= LineNumber, RemainingLine) > > IncFileProfile.InsertAdjust +=3D 1 > > self.CurrentLineNumber +=3D 1 > > @@ -704,7 +656,7 @@ class FdfParser: > > > > # comment out the processed include file statement > > TempList =3D list(self.Profile.FileLinesList[IncludeLi= ne - 1]) > > - TempList.insert(IncludeOffset, '#') > > + TempList.insert(IncludeOffset, TAB_COMMENT_SPLIT) > > self.Profile.FileLinesList[IncludeLine - 1] =3D ''.joi= n(TempList) > > if Processed: # Nested and back-to-back support > > self.Rewind(DestLine =3D IncFileProfile.InsertStartLin= eNumber - 1) > > @@ -713,7 +665,7 @@ class FdfParser: > > self.Rewind() > > > > @staticmethod > > - def __GetIfListCurrentItemStat(IfList): > > + def _GetIfListCurrentItemStat(IfList): > > if len(IfList) =3D=3D 0: > > return True > > > > @@ -735,29 +687,29 @@ class FdfParser: > > IfList =3D [] > > RegionLayoutLine =3D 0 > > ReplacedLine =3D -1 > > - while self.__GetNextToken(): > > + while self._GetNextToken(): > > # Determine section name and the location dependent macro > > - if self.__GetIfListCurrentItemStat(IfList): > > - if self.__Token.startswith('['): > > - Header =3D self.__Token > > - if not self.__Token.endswith(']'): > > - self.__SkipToToken(']') > > - Header +=3D self.__SkippedChars > > + if self._GetIfListCurrentItemStat(IfList): > > + if self._Token.startswith(TAB_SECTION_START): > > + Header =3D self._Token > > + if not self._Token.endswith(TAB_SECTION_END): > > + self._SkipToToken(TAB_SECTION_END) > > + Header +=3D self._SkippedChars > > if Header.find('$(') !=3D -1: > > raise Warning("macro cannot be used in section= header", self.FileName, self.CurrentLineNumber) > > - self.__SectionHeaderParser(Header) > > + self._SectionHeaderParser(Header) > > continue > > # Replace macros except in RULE section or out of sect= ion > > - elif self.__CurSection and ReplacedLine !=3D self.Curr= entLineNumber: > > + elif self._CurSection and ReplacedLine !=3D self.Curre= ntLineNumber: > > ReplacedLine =3D self.CurrentLineNumber > > - self.__UndoToken() > > + self._UndoToken() > > CurLine =3D self.Profile.FileLinesList[ReplacedLin= e - 1] > > PreIndex =3D 0 > > StartPos =3D CurLine.find('$(', PreIndex) > > EndPos =3D CurLine.find(')', StartPos+2) > > - while StartPos !=3D -1 and EndPos !=3D -1 and self= .__Token not in ['!ifdef', '!ifndef', '!if', '!elseif']: > > - MacroName =3D CurLine[StartPos+2 : EndPos] > > - MacorValue =3D self.__GetMacroValue(MacroName) > > + while StartPos !=3D -1 and EndPos !=3D -1 and self= ._Token not in [TAB_IF_DEF, TAB_IF_N_DEF, TAB_IF, > TAB_ELSE_IF]: > > + MacroName =3D CurLine[StartPos+2: EndPos] > > + MacorValue =3D self._GetMacroValue(MacroName) > > if MacorValue is not None: > > CurLine =3D CurLine.replace('$(' + MacroNa= me + ')', MacorValue, 1) > > if MacorValue.find('$(') !=3D -1: > > @@ -771,74 +723,74 @@ class FdfParser: > > self.Profile.FileLinesList[ReplacedLine - 1] =3D C= urLine > > continue > > > > - if self.__Token =3D=3D 'DEFINE': > > - if self.__GetIfListCurrentItemStat(IfList): > > - if not self.__CurSection: > > + if self._Token =3D=3D TAB_DEFINE: > > + if self._GetIfListCurrentItemStat(IfList): > > + if not self._CurSection: > > raise Warning("macro cannot be defined in Rule= section or out of section", self.FileName, > self.CurrentLineNumber) > > DefineLine =3D self.CurrentLineNumber - 1 > > - DefineOffset =3D self.CurrentOffsetWithinLine - le= n('DEFINE') > > - if not self.__GetNextToken(): > > + DefineOffset =3D self.CurrentOffsetWithinLine - le= n(TAB_DEFINE) > > + if not self._GetNextToken(): > > raise Warning("expected Macro name", self.File= Name, self.CurrentLineNumber) > > - Macro =3D self.__Token > > - if not self.__IsToken( "=3D"): > > + Macro =3D self._Token > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName,= self.CurrentLineNumber) > > > > - Value =3D self.__GetExpression() > > - self.__SetMacroValue(Macro, Value) > > - self.__WipeOffArea.append(((DefineLine, DefineOffs= et), (self.CurrentLineNumber - 1, > self.CurrentOffsetWithinLine - 1))) > > - elif self.__Token =3D=3D 'SET': > > - if not self.__GetIfListCurrentItemStat(IfList): > > + Value =3D self._GetExpression() > > + self._SetMacroValue(Macro, Value) > > + self._WipeOffArea.append(((DefineLine, DefineOffse= t), (self.CurrentLineNumber - 1, > self.CurrentOffsetWithinLine - 1))) > > + elif self._Token =3D=3D 'SET': > > + if not self._GetIfListCurrentItemStat(IfList): > > continue > > SetLine =3D self.CurrentLineNumber - 1 > > SetOffset =3D self.CurrentOffsetWithinLine - len('SET'= ) > > - PcdPair =3D self.__GetNextPcdSettings() > > + PcdPair =3D self._GetNextPcdSettings() > > PcdName =3D "%s.%s" % (PcdPair[1], PcdPair[0]) > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, sel= f.CurrentLineNumber) > > > > - Value =3D self.__GetExpression() > > - Value =3D self.__EvaluateConditional(Value, self.Curre= ntLineNumber, 'eval', True) > > + Value =3D self._GetExpression() > > + Value =3D self._EvaluateConditional(Value, self.Curren= tLineNumber, 'eval', True) > > > > - self.__PcdDict[PcdName] =3D Value > > + self._PcdDict[PcdName] =3D Value > > > > self.Profile.PcdDict[PcdPair] =3D Value > > self.SetPcdLocalation(PcdPair) > > FileLineTuple =3D GetRealFileLine(self.FileName, self.= CurrentLineNumber) > > self.Profile.PcdFileLineDict[PcdPair] =3D FileLineTupl= e > > > > - self.__WipeOffArea.append(((SetLine, SetOffset), (self= .CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > - elif self.__Token in ('!ifdef', '!ifndef', '!if'): > > - IfStartPos =3D (self.CurrentLineNumber - 1, self.Curre= ntOffsetWithinLine - len(self.__Token)) > > + self._WipeOffArea.append(((SetLine, SetOffset), (self.= CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > + elif self._Token in (TAB_IF_DEF, TAB_IF_N_DEF, TAB_IF): > > + IfStartPos =3D (self.CurrentLineNumber - 1, self.Curre= ntOffsetWithinLine - len(self._Token)) > > IfList.append([IfStartPos, None, None]) > > > > - CondLabel =3D self.__Token > > - Expression =3D self.__GetExpression() > > + CondLabel =3D self._Token > > + Expression =3D self._GetExpression() > > > > - if CondLabel =3D=3D '!if': > > - ConditionSatisfied =3D self.__EvaluateConditional(= Expression, IfList[-1][0][0] + 1, 'eval') > > + if CondLabel =3D=3D TAB_IF: > > + ConditionSatisfied =3D self._EvaluateConditional(E= xpression, IfList[-1][0][0] + 1, 'eval') > > else: > > - ConditionSatisfied =3D self.__EvaluateConditional(= Expression, IfList[-1][0][0] + 1, 'in') > > - if CondLabel =3D=3D '!ifndef': > > + ConditionSatisfied =3D self._EvaluateConditional(E= xpression, IfList[-1][0][0] + 1, 'in') > > + if CondLabel =3D=3D TAB_IF_N_DEF: > > ConditionSatisfied =3D not ConditionSatisfied > > > > BranchDetermined =3D ConditionSatisfied > > IfList[-1] =3D [IfList[-1][0], ConditionSatisfied, Bra= nchDetermined] > > if ConditionSatisfied: > > - self.__WipeOffArea.append((IfList[-1][0], (self.Cu= rrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > - elif self.__Token in ('!elseif', '!else'): > > - ElseStartPos =3D (self.CurrentLineNumber - 1, self.Cur= rentOffsetWithinLine - len(self.__Token)) > > + self._WipeOffArea.append((IfList[-1][0], (self.Cur= rentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > + elif self._Token in (TAB_ELSE_IF, '!else'): > > + ElseStartPos =3D (self.CurrentLineNumber - 1, self.Cur= rentOffsetWithinLine - len(self._Token)) > > if len(IfList) <=3D 0: > > raise Warning("Missing !if statement", self.FileNa= me, self.CurrentLineNumber) > > > > if IfList[-1][1]: > > IfList[-1] =3D [ElseStartPos, False, True] > > - self.__WipeOffArea.append((ElseStartPos, (self.Cur= rentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > + self._WipeOffArea.append((ElseStartPos, (self.Curr= entLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > else: > > - self.__WipeOffArea.append((IfList[-1][0], ElseStar= tPos)) > > + self._WipeOffArea.append((IfList[-1][0], ElseStart= Pos)) > > IfList[-1] =3D [ElseStartPos, True, IfList[-1][2]] > > - if self.__Token =3D=3D '!elseif': > > - Expression =3D self.__GetExpression() > > - ConditionSatisfied =3D self.__EvaluateConditio= nal(Expression, IfList[-1][0][0] + 1, 'eval') > > + if self._Token =3D=3D TAB_ELSE_IF: > > + Expression =3D self._GetExpression() > > + ConditionSatisfied =3D self._EvaluateCondition= al(Expression, IfList[-1][0][0] + 1, 'eval') > > IfList[-1] =3D [IfList[-1][0], ConditionSatisf= ied, IfList[-1][2]] > > > > if IfList[-1][1]: > > @@ -846,14 +798,14 @@ class FdfParser: > > IfList[-1][1] =3D False > > else: > > IfList[-1][2] =3D True > > - self.__WipeOffArea.append((IfList[-1][0], = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine > - 1))) > > - elif self.__Token =3D=3D '!endif': > > + self._WipeOffArea.append((IfList[-1][0], (= self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine > - 1))) > > + elif self._Token =3D=3D '!endif': > > if len(IfList) <=3D 0: > > raise Warning("Missing !if statement", self.FileNa= me, self.CurrentLineNumber) > > if IfList[-1][1]: > > - self.__WipeOffArea.append(((self.CurrentLineNumber= - 1, self.CurrentOffsetWithinLine - len('!endif')), > (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > + self._WipeOffArea.append(((self.CurrentLineNumber = - 1, self.CurrentOffsetWithinLine - len('!endif')), > (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > else: > > - self.__WipeOffArea.append((IfList[-1][0], (self.Cu= rrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > + self._WipeOffArea.append((IfList[-1][0], (self.Cur= rentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > > IfList.pop() > > elif not IfList: # Don't use PCDs inside conditional di= rective > > @@ -862,7 +814,7 @@ class FdfParser: > > continue > > SetPcd =3D ShortcutPcdPattern.match(self.Profile.FileL= inesList[self.CurrentLineNumber - 1]) > > if SetPcd: > > - self.__PcdDict[SetPcd.group('name')] =3D SetPcd.gr= oup('value') > > + self._PcdDict[SetPcd.group('name')] =3D SetPcd.gro= up('value') > > RegionLayoutLine =3D self.CurrentLineNumber > > continue > > RegionSize =3D RegionSizePattern.match(self.Profile.Fi= leLinesList[self.CurrentLineNumber - 1]) > > @@ -873,35 +825,35 @@ class FdfParser: > > if not RegionSizeGuid: > > RegionLayoutLine =3D self.CurrentLineNumber + 1 > > continue > > - self.__PcdDict[RegionSizeGuid.group('base')] =3D Regio= nSize.group('base') > > - self.__PcdDict[RegionSizeGuid.group('size')] =3D Regio= nSize.group('size') > > + self._PcdDict[RegionSizeGuid.group('base')] =3D Region= Size.group('base') > > + self._PcdDict[RegionSizeGuid.group('size')] =3D Region= Size.group('size') > > RegionLayoutLine =3D self.CurrentLineNumber + 1 > > > > if IfList: > > raise Warning("Missing !endif", self.FileName, self.Curren= tLineNumber) > > self.Rewind() > > > > - def __CollectMacroPcd(self): > > + def _CollectMacroPcd(self): > > MacroDict =3D {} > > > > # PCD macro > > MacroDict.update(GlobalData.gPlatformPcds) > > - MacroDict.update(self.__PcdDict) > > + MacroDict.update(self._PcdDict) > > > > # Lowest priority > > MacroDict.update(GlobalData.gPlatformDefines) > > > > - if self.__CurSection: > > + if self._CurSection: > > # Defines macro > > - ScopeMacro =3D self.__MacroDict[TAB_COMMON, TAB_COMMON, TA= B_COMMON] > > + ScopeMacro =3D self._MacroDict[TAB_COMMON, TAB_COMMON, TAB= _COMMON] > > if ScopeMacro: > > MacroDict.update(ScopeMacro) > > > > # Section macro > > - ScopeMacro =3D self.__MacroDict[ > > - self.__CurSection[0], > > - self.__CurSection[1], > > - self.__CurSection[2] > > + ScopeMacro =3D self._MacroDict[ > > + self._CurSection[0], > > + self._CurSection[1], > > + self._CurSection[2] > > ] > > if ScopeMacro: > > MacroDict.update(ScopeMacro) > > @@ -912,15 +864,15 @@ class FdfParser: > > for Item in GlobalData.BuildOptionPcd: > > if isinstance(Item, tuple): > > continue > > - PcdName, TmpValue =3D Item.split("=3D") > > + PcdName, TmpValue =3D Item.split(TAB_EQUAL_SPLIT) > > TmpValue =3D BuildOptionValue(TmpValue, {}) > > MacroDict[PcdName.strip()] =3D TmpValue > > # Highest priority > > > > return MacroDict > > > > - def __EvaluateConditional(self, Expression, Line, Op =3D None, Val= ue =3D None): > > - MacroPcdDict =3D self.__CollectMacroPcd() > > + def _EvaluateConditional(self, Expression, Line, Op =3D None, Valu= e =3D None): > > + MacroPcdDict =3D self._CollectMacroPcd() > > if Op =3D=3D 'eval': > > try: > > if Value: > > @@ -933,7 +885,7 @@ class FdfParser: > > # the precise number of line and return the evaluation= result > > # > > EdkLogger.warn('Parser', "Suspicious expression: %s" %= str(Excpt), > > - File=3Dself.FileName, ExtraData=3Dself= .__CurrentLine(), > > + File=3Dself.FileName, ExtraData=3Dself= ._CurrentLine(), > > Line=3DLine) > > return Excpt.result > > except Exception as Excpt: > > @@ -955,10 +907,10 @@ class FdfParser: > > Expression =3D Expression[2:-1] > > return Expression in MacroPcdDict > > > > - ## __IsToken() method > > + ## _IsToken() method > > # > > # Check whether input string is found from current char position= along > > - # If found, the string value is put into self.__Token > > + # If found, the string value is put into self._Token > > # > > # @param self The object pointer > > # @param String The string to search > > @@ -966,26 +918,26 @@ class FdfParser: > > # @retval True Successfully find string, file buffer poin= ter moved forward > > # @retval False Not able to find string, file buffer point= er not changed > > # > > - def __IsToken(self, String, IgnoreCase =3D False): > > - self.__SkipWhiteSpace() > > + def _IsToken(self, String, IgnoreCase =3D False): > > + self._SkipWhiteSpace() > > > > # Only consider the same line, no multi-line token allowed > > StartPos =3D self.CurrentOffsetWithinLine > > index =3D -1 > > if IgnoreCase: > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithinLin= e : ].upper().find(String.upper()) > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLine= : ].upper().find(String.upper()) > > else: > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithinLin= e : ].find(String) > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLine= : ].find(String) > > if index =3D=3D 0: > > self.CurrentOffsetWithinLine +=3D len(String) > > - self.__Token =3D self.__CurrentLine()[StartPos : self.Curr= entOffsetWithinLine] > > + self._Token =3D self._CurrentLine()[StartPos: self.Current= OffsetWithinLine] > > return True > > return False > > > > - ## __IsKeyword() method > > + ## _IsKeyword() method > > # > > # Check whether input keyword is found from current char positio= n along, whole word only! > > - # If found, the string value is put into self.__Token > > + # If found, the string value is put into self._Token > > # > > # @param self The object pointer > > # @param Keyword The string to search > > @@ -993,117 +945,117 @@ class FdfParser: > > # @retval True Successfully find string, file buffer poin= ter moved forward > > # @retval False Not able to find string, file buffer point= er not changed > > # > > - def __IsKeyword(self, KeyWord, IgnoreCase =3D False): > > - self.__SkipWhiteSpace() > > + def _IsKeyword(self, KeyWord, IgnoreCase =3D False): > > + self._SkipWhiteSpace() > > > > # Only consider the same line, no multi-line token allowed > > StartPos =3D self.CurrentOffsetWithinLine > > index =3D -1 > > if IgnoreCase: > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithinLin= e : ].upper().find(KeyWord.upper()) > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLine= : ].upper().find(KeyWord.upper()) > > else: > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithinLin= e : ].find(KeyWord) > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLine= : ].find(KeyWord) > > if index =3D=3D 0: > > - followingChar =3D self.__CurrentLine()[self.CurrentOffsetW= ithinLine + len(KeyWord)] > > - if not str(followingChar).isspace() and followingChar not = in SEPERATOR_TUPLE: > > + followingChar =3D self._CurrentLine()[self.CurrentOffsetWi= thinLine + len(KeyWord)] > > + if not str(followingChar).isspace() and followingChar not = in SEPARATORS: > > return False > > self.CurrentOffsetWithinLine +=3D len(KeyWord) > > - self.__Token =3D self.__CurrentLine()[StartPos : self.Curr= entOffsetWithinLine] > > + self._Token =3D self._CurrentLine()[StartPos: self.Current= OffsetWithinLine] > > return True > > return False > > > > - def __GetExpression(self): > > + def _GetExpression(self): > > Line =3D self.Profile.FileLinesList[self.CurrentLineNumber - 1= ] > > Index =3D len(Line) - 1 > > - while Line[Index] in ['\r', '\n']: > > + while Line[Index] in [T_CHAR_CR, TAB_LINE_BREAK]: > > Index -=3D 1 > > ExpressionString =3D self.Profile.FileLinesList[self.CurrentLi= neNumber - 1][self.CurrentOffsetWithinLine:Index+1] > > self.CurrentOffsetWithinLine +=3D len(ExpressionString) > > ExpressionString =3D ExpressionString.strip() > > return ExpressionString > > > > - ## __GetNextWord() method > > + ## _GetNextWord() method > > # > > # Get next C name from file lines > > - # If found, the string value is put into self.__Token > > + # If found, the string value is put into self._Token > > # > > # @param self The object pointer > > # @retval True Successfully find a C name string, file bu= ffer pointer moved forward > > # @retval False Not able to find a C name string, file buf= fer pointer not changed > > # > > - def __GetNextWord(self): > > - self.__SkipWhiteSpace() > > - if self.__EndOfFile(): > > + def _GetNextWord(self): > > + self._SkipWhiteSpace() > > + if self._EndOfFile(): > > return False > > > > - TempChar =3D self.__CurrentChar() > > + TempChar =3D self._CurrentChar() > > StartPos =3D self.CurrentOffsetWithinLine > > if (TempChar >=3D 'a' and TempChar <=3D 'z') or (TempChar >=3D= 'A' and TempChar <=3D 'Z') or TempChar =3D=3D '_': > > - self.__GetOneChar() > > - while not self.__EndOfLine(): > > - TempChar =3D self.__CurrentChar() > > + self._GetOneChar() > > + while not self._EndOfLine(): > > + TempChar =3D self._CurrentChar() > > if (TempChar >=3D 'a' and TempChar <=3D 'z') or (TempC= har >=3D 'A' and TempChar <=3D 'Z') \ > > or (TempChar >=3D '0' and TempChar <=3D '9') or TempCh= ar =3D=3D '_' or TempChar =3D=3D '-': > > - self.__GetOneChar() > > + self._GetOneChar() > > > > else: > > break > > > > - self.__Token =3D self.__CurrentLine()[StartPos : self.Curr= entOffsetWithinLine] > > + self._Token =3D self._CurrentLine()[StartPos: self.Current= OffsetWithinLine] > > return True > > > > return False > > > > - def __GetNextPcdWord(self): > > - self.__SkipWhiteSpace() > > - if self.__EndOfFile(): > > + def _GetNextPcdWord(self): > > + self._SkipWhiteSpace() > > + if self._EndOfFile(): > > return False > > > > - TempChar =3D self.__CurrentChar() > > + TempChar =3D self._CurrentChar() > > StartPos =3D self.CurrentOffsetWithinLine > > - if (TempChar >=3D 'a' and TempChar <=3D 'z') or (TempChar >=3D= 'A' and TempChar <=3D 'Z') or TempChar =3D=3D '_' or TempChar =3D=3D '[' > or TempChar =3D=3D ']': > > - self.__GetOneChar() > > - while not self.__EndOfLine(): > > - TempChar =3D self.__CurrentChar() > > + if (TempChar >=3D 'a' and TempChar <=3D 'z') or (TempChar >=3D= 'A' and TempChar <=3D 'Z') or TempChar =3D=3D '_' or TempChar =3D=3D > TAB_SECTION_START or TempChar =3D=3D TAB_SECTION_END: > > + self._GetOneChar() > > + while not self._EndOfLine(): > > + TempChar =3D self._CurrentChar() > > if (TempChar >=3D 'a' and TempChar <=3D 'z') or (TempC= har >=3D 'A' and TempChar <=3D 'Z') \ > > - or (TempChar >=3D '0' and TempChar <=3D '9') or TempCh= ar =3D=3D '_' or TempChar =3D=3D '-' or TempChar =3D=3D '[' or > TempChar =3D=3D ']': > > - self.__GetOneChar() > > + or (TempChar >=3D '0' and TempChar <=3D '9') or TempCh= ar =3D=3D '_' or TempChar =3D=3D '-' or TempChar =3D=3D > TAB_SECTION_START or TempChar =3D=3D TAB_SECTION_END: > > + self._GetOneChar() > > > > else: > > break > > > > - self.__Token =3D self.__CurrentLine()[StartPos : self.Curr= entOffsetWithinLine] > > + self._Token =3D self._CurrentLine()[StartPos: self.Current= OffsetWithinLine] > > return True > > > > return False > > > > - ## __GetNextToken() method > > + ## _GetNextToken() method > > # > > # Get next token unit before a seperator > > - # If found, the string value is put into self.__Token > > + # If found, the string value is put into self._Token > > # > > # @param self The object pointer > > # @retval True Successfully find a token unit, file buffe= r pointer moved forward > > # @retval False Not able to find a token unit, file buffer= pointer not changed > > # > > - def __GetNextToken(self): > > + def _GetNextToken(self): > > # Skip leading spaces, if exist. > > - self.__SkipWhiteSpace() > > - if self.__EndOfFile(): > > + self._SkipWhiteSpace() > > + if self._EndOfFile(): > > return False > > # Record the token start position, the position of the first n= on-space char. > > StartPos =3D self.CurrentOffsetWithinLine > > StartLine =3D self.CurrentLineNumber > > while StartLine =3D=3D self.CurrentLineNumber: > > - TempChar =3D self.__CurrentChar() > > + TempChar =3D self._CurrentChar() > > # Try to find the end char that is not a space and not in = seperator tuple. > > # That is, when we got a space or any char in the tuple, w= e got the end of token. > > - if not str(TempChar).isspace() and TempChar not in SEPERAT= OR_TUPLE: > > - self.__GetOneChar() > > + if not str(TempChar).isspace() and TempChar not in SEPARAT= ORS: > > + self._GetOneChar() > > # if we happen to meet a seperator as the first char, we m= ust proceed to get it. > > # That is, we get a token that is a seperator char. nomall= y it is the boundary of other tokens. > > - elif StartPos =3D=3D self.CurrentOffsetWithinLine and Temp= Char in SEPERATOR_TUPLE: > > - self.__GetOneChar() > > + elif StartPos =3D=3D self.CurrentOffsetWithinLine and Temp= Char in SEPARATORS: > > + self._GetOneChar() > > break > > else: > > break > > @@ -1113,35 +1065,34 @@ class FdfParser: > > EndPos =3D self.CurrentOffsetWithinLine > > if self.CurrentLineNumber !=3D StartLine: > > EndPos =3D len(self.Profile.FileLinesList[StartLine-1]) > > - self.__Token =3D self.Profile.FileLinesList[StartLine-1][Start= Pos : EndPos] > > - if self.__Token.lower() in [TAB_IF, TAB_END_IF, TAB_ELSE_IF, T= AB_ELSE, TAB_IF_DEF, TAB_IF_N_DEF, TAB_ERROR, > TAB_INCLUDE]: > > - self.__Token =3D self.__Token.lower() > > + self._Token =3D self.Profile.FileLinesList[StartLine-1][StartP= os: EndPos] > > + if self._Token.lower() in [TAB_IF, TAB_END_IF, TAB_ELSE_IF, TA= B_ELSE, TAB_IF_DEF, TAB_IF_N_DEF, TAB_ERROR, > TAB_INCLUDE]: > > + self._Token =3D self._Token.lower() > > if StartPos !=3D self.CurrentOffsetWithinLine: > > return True > > else: > > return False > > > > - ## __GetNextGuid() method > > + ## _GetNextGuid() method > > # > > # Get next token unit before a seperator > > - # If found, the GUID string is put into self.__Token > > + # If found, the GUID string is put into self._Token > > # > > # @param self The object pointer > > # @retval True Successfully find a registry format GUID, = file buffer pointer moved forward > > # @retval False Not able to find a registry format GUID, f= ile buffer pointer not changed > > # > > - def __GetNextGuid(self): > > - > > - if not self.__GetNextToken(): > > + def _GetNextGuid(self): > > + if not self._GetNextToken(): > > return False > > - if gGuidPattern.match(self.__Token) is not None: > > + if gGuidPattern.match(self._Token) is not None: > > return True > > else: > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > @staticmethod > > - def __Verify(Name, Value, Scope): > > + def _Verify(Name, Value, Scope): > > # value verification only applies to numeric values. > > if Scope not in TAB_PCD_NUMERIC_TYPES: > > return > > @@ -1157,17 +1108,17 @@ class FdfParser: > > EdkLogger.error("FdfParser", FORMAT_INVALID, "Too large va= lue for %s." % Name) > > return True > > > > - ## __UndoToken() method > > + ## _UndoToken() method > > # > > # Go back one token unit in file buffer > > # > > # @param self The object pointer > > # > > - def __UndoToken(self): > > - self.__UndoOneChar() > > - while self.__CurrentChar().isspace(): > > - if not self.__UndoOneChar(): > > - self.__GetOneChar() > > + def _UndoToken(self): > > + self._UndoOneChar() > > + while self._CurrentChar().isspace(): > > + if not self._UndoOneChar(): > > + self._GetOneChar() > > return > > > > > > @@ -1175,118 +1126,118 @@ class FdfParser: > > CurrentLine =3D self.CurrentLineNumber > > while CurrentLine =3D=3D self.CurrentLineNumber: > > > > - TempChar =3D self.__CurrentChar() > > + TempChar =3D self._CurrentChar() > > # Try to find the end char that is not a space and not in = seperator tuple. > > # That is, when we got a space or any char in the tuple, w= e got the end of token. > > - if not str(TempChar).isspace() and not TempChar in SEPERAT= OR_TUPLE: > > - if not self.__UndoOneChar(): > > + if not str(TempChar).isspace() and not TempChar in SEPARAT= ORS: > > + if not self._UndoOneChar(): > > return > > # if we happen to meet a seperator as the first char, we m= ust proceed to get it. > > # That is, we get a token that is a seperator char. nomall= y it is the boundary of other tokens. > > - elif StartPos =3D=3D self.CurrentOffsetWithinLine and Temp= Char in SEPERATOR_TUPLE: > > + elif StartPos =3D=3D self.CurrentOffsetWithinLine and Temp= Char in SEPARATORS: > > return > > else: > > break > > > > - self.__GetOneChar() > > + self._GetOneChar() > > > > - ## __GetNextHexNumber() method > > + ## _GetNextHexNumber() method > > # > > # Get next HEX data before a seperator > > - # If found, the HEX data is put into self.__Token > > + # If found, the HEX data is put into self._Token > > # > > # @param self The object pointer > > # @retval True Successfully find a HEX data, file buffer = pointer moved forward > > # @retval False Not able to find a HEX data, file buffer p= ointer not changed > > # > > - def __GetNextHexNumber(self): > > - if not self.__GetNextToken(): > > + def _GetNextHexNumber(self): > > + if not self._GetNextToken(): > > return False > > - if gHexPatternAll.match(self.__Token): > > + if gHexPatternAll.match(self._Token): > > return True > > else: > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - ## __GetNextDecimalNumber() method > > + ## _GetNextDecimalNumber() method > > # > > # Get next decimal data before a seperator > > - # If found, the decimal data is put into self.__Token > > + # If found, the decimal data is put into self._Token > > # > > # @param self The object pointer > > # @retval True Successfully find a decimal data, file buf= fer pointer moved forward > > # @retval False Not able to find a decimal data, file buff= er pointer not changed > > # > > - def __GetNextDecimalNumber(self): > > - if not self.__GetNextToken(): > > + def _GetNextDecimalNumber(self): > > + if not self._GetNextToken(): > > return False > > - if self.__Token.isdigit(): > > + if self._Token.isdigit(): > > return True > > else: > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - def __GetNextPcdSettings(self): > > - if not self.__GetNextWord(): > > + def _GetNextPcdSettings(self): > > + if not self._GetNextWord(): > > raise Warning("expected format of .", self.FileName, self.CurrentLineNumber) > > - pcdTokenSpaceCName =3D self.__Token > > + pcdTokenSpaceCName =3D self._Token > > > > - if not self.__IsToken( "."): > > + if not self._IsToken(TAB_SPLIT): > > raise Warning("expected format of .", self.FileName, self.CurrentLineNumber) > > > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > raise Warning("expected format of .", self.FileName, self.CurrentLineNumber) > > - pcdCName =3D self.__Token > > + pcdCName =3D self._Token > > > > Fields =3D [] > > - while self.__IsToken("."): > > - if not self.__GetNextPcdWord(): > > + while self._IsToken(TAB_SPLIT): > > + if not self._GetNextPcdWord(): > > raise Warning("expected format of = .", self.FileName, > self.CurrentLineNumber) > > - Fields.append(self.__Token) > > + Fields.append(self._Token) > > > > - return (pcdCName, pcdTokenSpaceCName,".".join(Fields)) > > + return (pcdCName, pcdTokenSpaceCName,TAB_SPLIT.join(Fields)) > > > > - ## __GetStringData() method > > + ## _GetStringData() method > > # > > # Get string contents quoted in "" > > - # If found, the decimal data is put into self.__Token > > + # If found, the decimal data is put into self._Token > > # > > # @param self The object pointer > > # @retval True Successfully find a string data, file buff= er pointer moved forward > > # @retval False Not able to find a string data, file buffe= r pointer not changed > > # > > - def __GetStringData(self): > > - if self.__Token.startswith("\"") or self.__Token.startswith("L= \""): > > - self.__UndoToken() > > - self.__SkipToToken("\"") > > + def _GetStringData(self): > > + if self._Token.startswith(T_CHAR_DOUBLE_QUOTE) or self._Token.= startswith("L\""): > > + self._UndoToken() > > + self._SkipToToken(T_CHAR_DOUBLE_QUOTE) > > currentLineNumber =3D self.CurrentLineNumber > > > > - if not self.__SkipToToken("\""): > > + if not self._SkipToToken(T_CHAR_DOUBLE_QUOTE): > > raise Warning("Missing Quote \" for String", self.File= Name, self.CurrentLineNumber) > > if currentLineNumber !=3D self.CurrentLineNumber: > > raise Warning("Missing Quote \" for String", self.File= Name, self.CurrentLineNumber) > > - self.__Token =3D self.__SkippedChars.rstrip('\"') > > + self._Token =3D self._SkippedChars.rstrip(T_CHAR_DOUBLE_QU= OTE) > > return True > > > > - elif self.__Token.startswith("\'") or self.__Token.startswith(= "L\'"): > > - self.__UndoToken() > > - self.__SkipToToken("\'") > > + elif self._Token.startswith(T_CHAR_SINGLE_QUOTE) or self._Toke= n.startswith("L\'"): > > + self._UndoToken() > > + self._SkipToToken(T_CHAR_SINGLE_QUOTE) > > currentLineNumber =3D self.CurrentLineNumber > > > > - if not self.__SkipToToken("\'"): > > + if not self._SkipToToken(T_CHAR_SINGLE_QUOTE): > > raise Warning("Missing Quote \' for String", self.File= Name, self.CurrentLineNumber) > > if currentLineNumber !=3D self.CurrentLineNumber: > > raise Warning("Missing Quote \' for String", self.File= Name, self.CurrentLineNumber) > > - self.__Token =3D self.__SkippedChars.rstrip('\'') > > + self._Token =3D self._SkippedChars.rstrip(T_CHAR_SINGLE_QU= OTE) > > return True > > > > else: > > return False > > > > - ## __SkipToToken() method > > + ## _SkipToToken() method > > # > > # Search forward in file buffer for the string > > - # The skipped chars are put into self.__SkippedChars > > + # The skipped chars are put into self._SkippedChars > > # > > # @param self The object pointer > > # @param String The string to search > > @@ -1294,25 +1245,25 @@ class FdfParser: > > # @retval True Successfully find the string, file buffer = pointer moved forward > > # @retval False Not able to find the string, file buffer p= ointer not changed > > # > > - def __SkipToToken(self, String, IgnoreCase =3D False): > > + def _SkipToToken(self, String, IgnoreCase =3D False): > > StartPos =3D self.GetFileBufferPos() > > > > - self.__SkippedChars =3D "" > > - while not self.__EndOfFile(): > > + self._SkippedChars =3D "" > > + while not self._EndOfFile(): > > index =3D -1 > > if IgnoreCase: > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithi= nLine : ].upper().find(String.upper()) > > + index =3D self._CurrentLine()[self.CurrentOffsetWithin= Line: ].upper().find(String.upper()) > > else: > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithi= nLine : ].find(String) > > + index =3D self._CurrentLine()[self.CurrentOffsetWithin= Line: ].find(String) > > if index =3D=3D 0: > > self.CurrentOffsetWithinLine +=3D len(String) > > - self.__SkippedChars +=3D String > > + self._SkippedChars +=3D String > > return True > > - self.__SkippedChars +=3D str(self.__CurrentChar()) > > - self.__GetOneChar() > > + self._SkippedChars +=3D str(self._CurrentChar()) > > + self._GetOneChar() > > > > - self.SetFileBufferPos( StartPos) > > - self.__SkippedChars =3D "" > > + self.SetFileBufferPos(StartPos) > > + self._SkippedChars =3D "" > > return False > > > > ## GetFileBufferPos() method > > @@ -1343,18 +1294,18 @@ class FdfParser: > > # @param self The object pointer > > # > > def Preprocess(self): > > - self.__StringToList() > > + self._StringToList() > > self.PreprocessFile() > > self.PreprocessIncludeFile() > > - self.__StringToList() > > + self._StringToList() > > self.PreprocessFile() > > self.PreprocessConditionalStatement() > > - self.__StringToList() > > - for Pos in self.__WipeOffArea: > > - self.__ReplaceFragment(Pos[0], Pos[1]) > > + self._StringToList() > > + for Pos in self._WipeOffArea: > > + self._ReplaceFragment(Pos[0], Pos[1]) > > self.Profile.FileLinesList =3D ["".join(list) for list in self= .Profile.FileLinesList] > > > > - while self.__GetDefines(): > > + while self._GetDefines(): > > pass > > > > ## ParseFile() method > > @@ -1365,19 +1316,18 @@ class FdfParser: > > # @param self The object pointer > > # > > def ParseFile(self): > > - > > try: > > self.Preprocess() > > - self.__GetError() > > + self._GetError() > > # > > # Keep processing sections of the FDF until no new section= s or a syntax error is found > > # > > - while self.__GetFd() or self.__GetFv() or self.__GetFmp() = or self.__GetCapsule() or self.__GetVtf() or self.__GetRule() or > self.__GetOptionRom(): > > + while self._GetFd() or self._GetFv() or self._GetFmp() or = self._GetCapsule() or self._GetVtf() or self._GetRule() or > self._GetOptionRom(): > > pass > > > > except Warning as X: > > - self.__UndoToken() > > - #'\n\tGot Token: \"%s\" from File %s\n' % (self.__Token, F= ileLineTuple[0]) + \ > > + self._UndoToken() > > + #'\n\tGot Token: \"%s\" from File %s\n' % (self._Token, Fi= leLineTuple[0]) + \ > > # At this point, the closest parent would be the included = file itself > > Profile =3D GetParentAtLine(X.OriginalLineNumber) > > if Profile is not None: > > @@ -1386,7 +1336,7 @@ class FdfParser: > > else: > > FileLineTuple =3D GetRealFileLine(self.FileName, self.= CurrentLineNumber) > > X.Message +=3D ' near line %d, column %d: %s' \ > > - % (FileLineTuple[1], self.CurrentOffsetWithinLine + 1,= self.Profile.FileLinesList[self.CurrentLineNumber - > 1][self.CurrentOffsetWithinLine :].rstrip('\n').rstrip('\r')) > > + % (FileLineTuple[1], self.CurrentOffsetWithinLine + 1,= self.Profile.FileLinesList[self.CurrentLineNumber - > 1][self.CurrentOffsetWithinLine:].rstrip(TAB_LINE_BREAK).rstrip(T_CHAR_CR= )) > > raise > > > > ## SectionParser() method > > @@ -1403,7 +1353,7 @@ class FdfParser: > > and not S.startswith("[VTF.") and not S.startswith("[RULE.= ") and not S.startswith("[OPTIONROM.") and not > S.startswith('[FMPPAYLOAD.'): > > raise Warning("Unknown section or section appear sequence = error (The correct sequence should be [DEFINES], [FD.], > [FV.], [Capsule.], [VTF.], [Rule.], [OptionRom.], [FMPPAYLOAD.])", self.F= ileName, self.CurrentLineNumber) > > > > - ## __GetDefines() method > > + ## _GetDefines() method > > # > > # Get Defines section contents and store its data into AllMacros= List > > # > > @@ -1411,56 +1361,55 @@ class FdfParser: > > # @retval True Successfully find a Defines > > # @retval False Not able to find a Defines > > # > > - def __GetDefines(self): > > - > > - if not self.__GetNextToken(): > > + def _GetDefines(self): > > + if not self._GetNextToken(): > > return False > > > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[DEFINES"): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[DEFI= NES"): > > self.SectionParser(S) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - self.__UndoToken() > > - if not self.__IsToken("[DEFINES", True): > > + self._UndoToken() > > + if not self._IsToken("[DEFINES", True): > > FileLineTuple =3D GetRealFileLine(self.FileName, self.Curr= entLineNumber) > > #print 'Parsing String: %s in File %s, At line: %d, Offset= Within Line: %d' \ > > - # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > + # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > raise Warning("expected [DEFINES", self.FileName, self.Cur= rentLineNumber) > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - while self.__GetNextWord(): > > + while self._GetNextWord(): > > # handle the SET statement > > - if self.__Token =3D=3D 'SET': > > - self.__UndoToken() > > - self.__GetSetStatement(None) > > + if self._Token =3D=3D 'SET': > > + self._UndoToken() > > + self._GetSetStatement(None) > > continue > > > > - Macro =3D self.__Token > > + Macro =3D self._Token > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken() or self.__Token.startswith('[= '): > > + if not self._GetNextToken() or self._Token.startswith(TAB_= SECTION_START): > > raise Warning("expected MACRO value", self.FileName, s= elf.CurrentLineNumber) > > - Value =3D self.__Token > > + Value =3D self._Token > > > > return False > > > > - ##__GetError() method > > - def __GetError(self): > > + ##_GetError() method > > + def _GetError(self): > > #save the Current information > > CurrentLine =3D self.CurrentLineNumber > > CurrentOffset =3D self.CurrentOffsetWithinLine > > - while self.__GetNextToken(): > > - if self.__Token =3D=3D TAB_ERROR: > > - EdkLogger.error('FdfParser', ERROR_STATEMENT, self.__C= urrentLine().replace(TAB_ERROR, '', 1), > File=3Dself.FileName, Line=3Dself.CurrentLineNumber) > > + while self._GetNextToken(): > > + if self._Token =3D=3D TAB_ERROR: > > + EdkLogger.error('FdfParser', ERROR_STATEMENT, self._Cu= rrentLine().replace(TAB_ERROR, '', 1), > File=3Dself.FileName, Line=3Dself.CurrentLineNumber) > > self.CurrentLineNumber =3D CurrentLine > > self.CurrentOffsetWithinLine =3D CurrentOffset > > > > - ## __GetFd() method > > + ## _GetFd() method > > # > > # Get FD section contents and store its data into FD dictionary = of self.Profile > > # > > @@ -1468,27 +1417,26 @@ class FdfParser: > > # @retval True Successfully find a FD > > # @retval False Not able to find a FD > > # > > - def __GetFd(self): > > - > > - if not self.__GetNextToken(): > > + def _GetFd(self): > > + if not self._GetNextToken(): > > return False > > > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[FD."): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[FD."= ): > > if not S.startswith("[FV.") and not S.startswith('[FMPPAYL= OAD.') and not S.startswith("[CAPSULE.") \ > > and not S.startswith("[VTF.") and not S.startswith("[R= ULE.") and not S.startswith("[OPTIONROM."): > > raise Warning("Unknown section", self.FileName, self.C= urrentLineNumber) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - self.__UndoToken() > > - if not self.__IsToken("[FD.", True): > > + self._UndoToken() > > + if not self._IsToken("[FD.", True): > > FileLineTuple =3D GetRealFileLine(self.FileName, self.Curr= entLineNumber) > > #print 'Parsing String: %s in File %s, At line: %d, Offset= Within Line: %d' \ > > - # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > + # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > raise Warning("expected [FD.]", self.FileName, self.Curren= tLineNumber) > > > > - FdName =3D self.__GetUiName() > > + FdName =3D self._GetUiName() > > if FdName =3D=3D "": > > if len (self.Profile.FdDict) =3D=3D 0: > > FdName =3D GenFdsGlobalVariable.PlatformName > > @@ -1502,56 +1450,56 @@ class FdfParser: > > if self.CurrentFdName in self.Profile.FdDict: > > raise Warning("Unexpected the same FD name", self.FileName= , self.CurrentLineNumber) > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - FdObj =3D Fd.FD() > > + FdObj =3D FD() > > FdObj.FdUiName =3D self.CurrentFdName > > self.Profile.FdDict[self.CurrentFdName] =3D FdObj > > > > if len (self.Profile.FdDict) > 1 and self.Profile.FdNameNotSet= : > > raise Warning("expected all FDs have their name", self.Fil= eName, self.CurrentLineNumber) > > > > - Status =3D self.__GetCreateFile(FdObj) > > + Status =3D self._GetCreateFile(FdObj) > > if not Status: > > raise Warning("FD name error", self.FileName, self.Current= LineNumber) > > > > - while self.__GetTokenStatements(FdObj): > > + while self._GetTokenStatements(FdObj): > > pass > > for Attr in ("BaseAddress", "Size", "ErasePolarity"): > > if getattr(FdObj, Attr) is None: > > - self.__GetNextToken() > > + self._GetNextToken() > > raise Warning("Keyword %s missing" % Attr, self.FileNa= me, self.CurrentLineNumber) > > > > if not FdObj.BlockSizeList: > > FdObj.BlockSizeList.append((1, FdObj.Size, None)) > > > > - self.__GetDefineStatements(FdObj) > > + self._GetDefineStatements(FdObj) > > > > - self.__GetSetStatements(FdObj) > > + self._GetSetStatements(FdObj) > > > > - if not self.__GetRegionLayout(FdObj): > > + if not self._GetRegionLayout(FdObj): > > raise Warning("expected region layout", self.FileName, sel= f.CurrentLineNumber) > > > > - while self.__GetRegionLayout(FdObj): > > + while self._GetRegionLayout(FdObj): > > pass > > return True > > > > - ## __GetUiName() method > > + ## _GetUiName() method > > # > > # Return the UI name of a section > > # > > # @param self The object pointer > > # @retval FdName UI name > > # > > - def __GetUiName(self): > > + def _GetUiName(self): > > Name =3D "" > > - if self.__GetNextWord(): > > - Name =3D self.__Token > > + if self._GetNextWord(): > > + Name =3D self._Token > > > > return Name > > > > - ## __GetCreateFile() method > > + ## _GetCreateFile() method > > # > > # Return the output file name of object > > # > > @@ -1559,16 +1507,15 @@ class FdfParser: > > # @param Obj object whose data will be stored in file > > # @retval FdName UI name > > # > > - def __GetCreateFile(self, Obj): > > - > > - if self.__IsKeyword( "CREATE_FILE"): > > - if not self.__IsToken( "=3D"): > > + def _GetCreateFile(self, Obj): > > + if self._IsKeyword("CREATE_FILE"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected file name", self.FileName, sel= f.CurrentLineNumber) > > > > - FileName =3D self.__Token > > + FileName =3D self._Token > > Obj.CreateFileName =3D FileName > > > > return True > > @@ -1576,25 +1523,25 @@ class FdfParser: > > def SetPcdLocalation(self,pcdpair): > > self.Profile.PcdLocalDict[pcdpair] =3D (self.Profile.FileName,= self.CurrentLineNumber) > > > > - ## __GetTokenStatements() method > > + ## _GetTokenStatements() method > > # > > # Get token statements > > # > > # @param self The object pointer > > # @param Obj for whom token statement is got > > # > > - def __GetTokenStatements(self, Obj): > > - if self.__IsKeyword( "BaseAddress"): > > - if not self.__IsToken( "=3D"): > > + def _GetTokenStatements(self, Obj): > > + if self._IsKeyword("BaseAddress"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex base address", self.FileNa= me, self.CurrentLineNumber) > > > > - Obj.BaseAddress =3D self.__Token > > + Obj.BaseAddress =3D self._Token > > > > - if self.__IsToken( "|"): > > - pcdPair =3D self.__GetNextPcdSettings() > > + if self._IsToken(TAB_VALUE_SPLIT): > > + pcdPair =3D self._GetNextPcdSettings() > > Obj.BaseAddressPcd =3D pcdPair > > self.Profile.PcdDict[pcdPair] =3D Obj.BaseAddress > > self.SetPcdLocalation(pcdPair) > > @@ -1602,16 +1549,16 @@ class FdfParser: > > self.Profile.PcdFileLineDict[pcdPair] =3D FileLineTupl= e > > return True > > > > - if self.__IsKeyword( "Size"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("Size"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex size", self.FileName, self= .CurrentLineNumber) > > > > - Size =3D self.__Token > > - if self.__IsToken( "|"): > > - pcdPair =3D self.__GetNextPcdSettings() > > + Size =3D self._Token > > + if self._IsToken(TAB_VALUE_SPLIT): > > + pcdPair =3D self._GetNextPcdSettings() > > Obj.SizePcd =3D pcdPair > > self.Profile.PcdDict[pcdPair] =3D Size > > self.SetPcdLocalation(pcdPair) > > @@ -1620,22 +1567,22 @@ class FdfParser: > > Obj.Size =3D long(Size, 0) > > return True > > > > - if self.__IsKeyword( "ErasePolarity"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("ErasePolarity"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Erase Polarity", self.FileName= , self.CurrentLineNumber) > > > > - if self.__Token !=3D "1" and self.__Token !=3D "0": > > + if self._Token !=3D "1" and self._Token !=3D "0": > > raise Warning("expected 1 or 0 Erase Polarity", self.F= ileName, self.CurrentLineNumber) > > > > - Obj.ErasePolarity =3D self.__Token > > + Obj.ErasePolarity =3D self._Token > > return True > > > > - return self.__GetBlockStatements(Obj) > > + return self._GetBlockStatements(Obj) > > > > - ## __GetAddressStatements() method > > + ## _GetAddressStatements() method > > # > > # Get address statements > > # > > @@ -1644,38 +1591,37 @@ class FdfParser: > > # @retval True Successfully find > > # @retval False Not able to find > > # > > - def __GetAddressStatements(self, Obj): > > - > > - if self.__IsKeyword("BsBaseAddress"): > > - if not self.__IsToken( "=3D"): > > + def _GetAddressStatements(self, Obj): > > + if self._IsKeyword("BsBaseAddress"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextDecimalNumber() and not self.__GetNex= tHexNumber(): > > + if not self._GetNextDecimalNumber() and not self._GetNextH= exNumber(): > > raise Warning("expected address", self.FileName, self.= CurrentLineNumber) > > > > - BsAddress =3D long(self.__Token, 0) > > + BsAddress =3D long(self._Token, 0) > > Obj.BsBaseAddress =3D BsAddress > > > > - if self.__IsKeyword("RtBaseAddress"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("RtBaseAddress"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextDecimalNumber() and not self.__GetNex= tHexNumber(): > > + if not self._GetNextDecimalNumber() and not self._GetNextH= exNumber(): > > raise Warning("expected address", self.FileName, self.= CurrentLineNumber) > > > > - RtAddress =3D long(self.__Token, 0) > > + RtAddress =3D long(self._Token, 0) > > Obj.RtBaseAddress =3D RtAddress > > > > - ## __GetBlockStatements() method > > + ## _GetBlockStatements() method > > # > > # Get block statements > > # > > # @param self The object pointer > > # @param Obj for whom block statement is got > > # > > - def __GetBlockStatements(self, Obj): > > + def _GetBlockStatements(self, Obj): > > IsBlock =3D False > > - while self.__GetBlockStatement(Obj): > > + while self._GetBlockStatement(Obj): > > IsBlock =3D True > > > > Item =3D Obj.BlockSizeList[-1] > > @@ -1683,7 +1629,7 @@ class FdfParser: > > raise Warning("expected block statement", self.FileNam= e, self.CurrentLineNumber) > > return IsBlock > > > > - ## __GetBlockStatement() method > > + ## _GetBlockStatement() method > > # > > # Get block statement > > # > > @@ -1692,20 +1638,20 @@ class FdfParser: > > # @retval True Successfully find > > # @retval False Not able to find > > # > > - def __GetBlockStatement(self, Obj): > > - if not self.__IsKeyword( "BlockSize"): > > + def _GetBlockStatement(self, Obj): > > + if not self._IsKeyword("BlockSize"): > > return False > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextHexNumber() and not self.__GetNextDecimal= Number(): > > + if not self._GetNextHexNumber() and not self._GetNextDecimalNu= mber(): > > raise Warning("expected Hex or Integer block size", self.F= ileName, self.CurrentLineNumber) > > > > - BlockSize =3D self.__Token > > + BlockSize =3D self._Token > > BlockSizePcd =3D None > > - if self.__IsToken( "|"): > > - PcdPair =3D self.__GetNextPcdSettings() > > + if self._IsToken(TAB_VALUE_SPLIT): > > + PcdPair =3D self._GetNextPcdSettings() > > BlockSizePcd =3D PcdPair > > self.Profile.PcdDict[PcdPair] =3D BlockSize > > self.SetPcdLocalation(PcdPair) > > @@ -1714,19 +1660,19 @@ class FdfParser: > > BlockSize =3D long(BlockSize, 0) > > > > BlockNumber =3D None > > - if self.__IsKeyword( "NumBlocks"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("NumBlocks"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextDecimalNumber() and not self.__GetNex= tHexNumber(): > > + if not self._GetNextDecimalNumber() and not self._GetNextH= exNumber(): > > raise Warning("expected block numbers", self.FileName,= self.CurrentLineNumber) > > > > - BlockNumber =3D long(self.__Token, 0) > > + BlockNumber =3D long(self._Token, 0) > > > > Obj.BlockSizeList.append((BlockSize, BlockNumber, BlockSizePcd= )) > > return True > > > > - ## __GetDefineStatements() method > > + ## _GetDefineStatements() method > > # > > # Get define statements > > # > > @@ -1735,11 +1681,11 @@ class FdfParser: > > # @retval True Successfully find > > # @retval False Not able to find > > # > > - def __GetDefineStatements(self, Obj): > > - while self.__GetDefineStatement( Obj): > > + def _GetDefineStatements(self, Obj): > > + while self._GetDefineStatement(Obj): > > pass > > > > - ## __GetDefineStatement() method > > + ## _GetDefineStatement() method > > # > > # Get define statement > > # > > @@ -1748,24 +1694,24 @@ class FdfParser: > > # @retval True Successfully find > > # @retval False Not able to find > > # > > - def __GetDefineStatement(self, Obj): > > - if self.__IsKeyword("DEFINE"): > > - self.__GetNextToken() > > - Macro =3D self.__Token > > - if not self.__IsToken( "=3D"): > > + def _GetDefineStatement(self, Obj): > > + if self._IsKeyword(TAB_DEFINE): > > + self._GetNextToken() > > + Macro =3D self._Token > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected value", self.FileName, self.Cu= rrentLineNumber) > > > > - Value =3D self.__Token > > + Value =3D self._Token > > Macro =3D '$(' + Macro + ')' > > Obj.DefineVarDict[Macro] =3D Value > > return True > > > > return False > > > > - ## __GetSetStatements() method > > + ## _GetSetStatements() method > > # > > # Get set statements > > # > > @@ -1774,11 +1720,11 @@ class FdfParser: > > # @retval True Successfully find > > # @retval False Not able to find > > # > > - def __GetSetStatements(self, Obj): > > - while self.__GetSetStatement(Obj): > > + def _GetSetStatements(self, Obj): > > + while self._GetSetStatement(Obj): > > pass > > > > - ## __GetSetStatement() method > > + ## _GetSetStatement() method > > # > > # Get set statement > > # > > @@ -1787,15 +1733,15 @@ class FdfParser: > > # @retval True Successfully find > > # @retval False Not able to find > > # > > - def __GetSetStatement(self, Obj): > > - if self.__IsKeyword("SET"): > > - PcdPair =3D self.__GetNextPcdSettings() > > + def _GetSetStatement(self, Obj): > > + if self._IsKeyword("SET"): > > + PcdPair =3D self._GetNextPcdSettings() > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - Value =3D self.__GetExpression() > > - Value =3D self.__EvaluateConditional(Value, self.CurrentLi= neNumber, 'eval', True) > > + Value =3D self._GetExpression() > > + Value =3D self._EvaluateConditional(Value, self.CurrentLin= eNumber, 'eval', True) > > > > if Obj: > > Obj.SetVarDict[PcdPair] =3D Value > > @@ -1807,19 +1753,19 @@ class FdfParser: > > > > return False > > > > - ## __CalcRegionExpr(self) > > + ## _CalcRegionExpr(self) > > # > > # Calculate expression for offset or size of a region > > # > > # @return: None if invalid expression > > # Calculated number if successfully > > # > > - def __CalcRegionExpr(self): > > + def _CalcRegionExpr(self): > > StartPos =3D self.GetFileBufferPos() > > Expr =3D '' > > PairCount =3D 0 > > - while not self.__EndOfFile(): > > - CurCh =3D self.__CurrentChar() > > + while not self._EndOfFile(): > > + CurCh =3D self._CurrentChar() > > if CurCh =3D=3D '(': > > PairCount +=3D 1 > > elif CurCh =3D=3D ')': > > @@ -1828,106 +1774,106 @@ class FdfParser: > > if CurCh in '|\r\n' and PairCount =3D=3D 0: > > break > > Expr +=3D CurCh > > - self.__GetOneChar() > > + self._GetOneChar() > > try: > > return long( > > ValueExpression(Expr, > > - self.__CollectMacroPcd() > > + self._CollectMacroPcd() > > )(True), 0) > > except Exception: > > self.SetFileBufferPos(StartPos) > > return None > > > > - ## __GetRegionLayout() method > > + ## _GetRegionLayout() method > > # > > # Get region layout for FD > > # > > # @param self The object pointer > > - # @param Fd for whom region is got > > + # @param theFd for whom region is got > > # @retval True Successfully find > > # @retval False Not able to find > > # > > - def __GetRegionLayout(self, Fd): > > - Offset =3D self.__CalcRegionExpr() > > + def _GetRegionLayout(self, theFd): > > + Offset =3D self._CalcRegionExpr() > > if Offset is None: > > return False > > > > - RegionObj =3D Region.Region() > > + RegionObj =3D Region() > > RegionObj.Offset =3D Offset > > - Fd.RegionList.append(RegionObj) > > + theFd.RegionList.append(RegionObj) > > > > - if not self.__IsToken( "|"): > > + if not self._IsToken(TAB_VALUE_SPLIT): > > raise Warning("expected '|'", self.FileName, self.CurrentL= ineNumber) > > > > - Size =3D self.__CalcRegionExpr() > > + Size =3D self._CalcRegionExpr() > > if Size is None: > > raise Warning("expected Region Size", self.FileName, self.= CurrentLineNumber) > > RegionObj.Size =3D Size > > > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > return True > > > > - if not self.__Token in ("SET", BINARY_FILE_TYPE_FV, "FILE", "D= ATA", "CAPSULE", "INF"): > > + if not self._Token in ("SET", BINARY_FILE_TYPE_FV, "FILE", "DA= TA", "CAPSULE", "INF"): > > # > > # If next token is a word which is not a valid FV type, it= might be part of [PcdOffset[|PcdSize]] > > # Or it might be next region's offset described by an expr= ession which starts with a PCD. > > # PcdOffset[|PcdSize] or OffsetPcdExpression|Size > > # > > - self.__UndoToken() > > - IsRegionPcd =3D (RegionSizeGuidPattern.match(self.__Curren= tLine()[self.CurrentOffsetWithinLine:]) or > > - RegionOffsetPcdPattern.match(self.__Current= Line()[self.CurrentOffsetWithinLine:])) > > + self._UndoToken() > > + IsRegionPcd =3D (RegionSizeGuidPattern.match(self._Current= Line()[self.CurrentOffsetWithinLine:]) or > > + RegionOffsetPcdPattern.match(self._CurrentL= ine()[self.CurrentOffsetWithinLine:])) > > if IsRegionPcd: > > - RegionObj.PcdOffset =3D self.__GetNextPcdSettings() > > - self.Profile.PcdDict[RegionObj.PcdOffset] =3D "0x%08X"= % (RegionObj.Offset + long(Fd.BaseAddress, 0)) > > + RegionObj.PcdOffset =3D self._GetNextPcdSettings() > > + self.Profile.PcdDict[RegionObj.PcdOffset] =3D "0x%08X"= % (RegionObj.Offset + long(theFd.BaseAddress, 0)) > > self.SetPcdLocalation(RegionObj.PcdOffset) > > - self.__PcdDict['%s.%s' % (RegionObj.PcdOffset[1], Regi= onObj.PcdOffset[0])] =3D "0x%x" % RegionObj.Offset > > + self._PcdDict['%s.%s' % (RegionObj.PcdOffset[1], Regio= nObj.PcdOffset[0])] =3D "0x%x" % RegionObj.Offset > > FileLineTuple =3D GetRealFileLine(self.FileName, self.= CurrentLineNumber) > > self.Profile.PcdFileLineDict[RegionObj.PcdOffset] =3D = FileLineTuple > > - if self.__IsToken( "|"): > > - RegionObj.PcdSize =3D self.__GetNextPcdSettings() > > + if self._IsToken(TAB_VALUE_SPLIT): > > + RegionObj.PcdSize =3D self._GetNextPcdSettings() > > self.Profile.PcdDict[RegionObj.PcdSize] =3D "0x%08= X" % RegionObj.Size > > self.SetPcdLocalation(RegionObj.PcdSize) > > - self.__PcdDict['%s.%s' % (RegionObj.PcdSize[1], Re= gionObj.PcdSize[0])] =3D "0x%x" % RegionObj.Size > > + self._PcdDict['%s.%s' % (RegionObj.PcdSize[1], Reg= ionObj.PcdSize[0])] =3D "0x%x" % RegionObj.Size > > FileLineTuple =3D GetRealFileLine(self.FileName, s= elf.CurrentLineNumber) > > self.Profile.PcdFileLineDict[RegionObj.PcdSize] = =3D FileLineTuple > > > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > return True > > > > - if self.__Token =3D=3D "SET": > > - self.__UndoToken() > > - self.__GetSetStatements( RegionObj) > > - if not self.__GetNextWord(): > > + if self._Token =3D=3D "SET": > > + self._UndoToken() > > + self._GetSetStatements(RegionObj) > > + if not self._GetNextWord(): > > return True > > > > - elif self.__Token =3D=3D BINARY_FILE_TYPE_FV: > > - self.__UndoToken() > > - self.__GetRegionFvType( RegionObj) > > + elif self._Token =3D=3D BINARY_FILE_TYPE_FV: > > + self._UndoToken() > > + self._GetRegionFvType(RegionObj) > > > > - elif self.__Token =3D=3D "CAPSULE": > > - self.__UndoToken() > > - self.__GetRegionCapType( RegionObj) > > + elif self._Token =3D=3D "CAPSULE": > > + self._UndoToken() > > + self._GetRegionCapType(RegionObj) > > > > - elif self.__Token =3D=3D "FILE": > > - self.__UndoToken() > > - self.__GetRegionFileType(RegionObj) > > + elif self._Token =3D=3D "FILE": > > + self._UndoToken() > > + self._GetRegionFileType(RegionObj) > > > > - elif self.__Token =3D=3D "INF": > > - self.__UndoToken() > > + elif self._Token =3D=3D "INF": > > + self._UndoToken() > > RegionObj.RegionType =3D "INF" > > - while self.__IsKeyword("INF"): > > - self.__UndoToken() > > - ffsInf =3D self.__ParseInfStatement() > > + while self._IsKeyword("INF"): > > + self._UndoToken() > > + ffsInf =3D self._ParseInfStatement() > > if not ffsInf: > > break > > RegionObj.RegionDataList.append(ffsInf) > > > > - elif self.__Token =3D=3D "DATA": > > - self.__UndoToken() > > - self.__GetRegionDataType(RegionObj) > > + elif self._Token =3D=3D "DATA": > > + self._UndoToken() > > + self._GetRegionDataType(RegionObj) > > else: > > - self.__UndoToken() > > - if self.__GetRegionLayout(Fd): > > + self._UndoToken() > > + if self._GetRegionLayout(theFd): > > return True > > raise Warning("A valid region type was not found. " > > "Valid types are [SET, FV, CAPSULE, FILE, DA= TA, INF]. This error occurred", > > @@ -1935,189 +1881,185 @@ class FdfParser: > > > > return True > > > > - ## __GetRegionFvType() method > > + ## _GetRegionFvType() method > > # > > # Get region fv data for region > > # > > # @param self The object pointer > > # @param RegionObj for whom region data is got > > # > > - def __GetRegionFvType(self, RegionObj): > > - > > - if not self.__IsKeyword( BINARY_FILE_TYPE_FV): > > + def _GetRegionFvType(self, RegionObj): > > + if not self._IsKeyword(BINARY_FILE_TYPE_FV): > > raise Warning("expected Keyword BINARY_FILE_TYPE_FV", self= .FileName, self.CurrentLineNumber) > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FV name", self.FileName, self.Curr= entLineNumber) > > > > RegionObj.RegionType =3D BINARY_FILE_TYPE_FV > > - RegionObj.RegionDataList.append((self.__Token).upper()) > > + RegionObj.RegionDataList.append((self._Token).upper()) > > > > - while self.__IsKeyword( BINARY_FILE_TYPE_FV): > > + while self._IsKeyword(BINARY_FILE_TYPE_FV): > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FV name", self.FileName, self.= CurrentLineNumber) > > > > - RegionObj.RegionDataList.append((self.__Token).upper()) > > + RegionObj.RegionDataList.append((self._Token).upper()) > > > > - ## __GetRegionCapType() method > > + ## _GetRegionCapType() method > > # > > # Get region capsule data for region > > # > > # @param self The object pointer > > # @param RegionObj for whom region data is got > > # > > - def __GetRegionCapType(self, RegionObj): > > - > > - if not self.__IsKeyword("CAPSULE"): > > + def _GetRegionCapType(self, RegionObj): > > + if not self._IsKeyword("CAPSULE"): > > raise Warning("expected Keyword 'CAPSULE'", self.FileName,= self.CurrentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected CAPSULE name", self.FileName, self= .CurrentLineNumber) > > > > RegionObj.RegionType =3D "CAPSULE" > > - RegionObj.RegionDataList.append(self.__Token) > > + RegionObj.RegionDataList.append(self._Token) > > > > - while self.__IsKeyword("CAPSULE"): > > + while self._IsKeyword("CAPSULE"): > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected CAPSULE name", self.FileName, = self.CurrentLineNumber) > > > > - RegionObj.RegionDataList.append(self.__Token) > > + RegionObj.RegionDataList.append(self._Token) > > > > - ## __GetRegionFileType() method > > + ## _GetRegionFileType() method > > # > > # Get region file data for region > > # > > # @param self The object pointer > > # @param RegionObj for whom region data is got > > # > > - def __GetRegionFileType(self, RegionObj): > > - > > - if not self.__IsKeyword( "FILE"): > > + def _GetRegionFileType(self, RegionObj): > > + if not self._IsKeyword("FILE"): > > raise Warning("expected Keyword 'FILE'", self.FileName, se= lf.CurrentLineNumber) > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected File name", self.FileName, self.Cu= rrentLineNumber) > > > > RegionObj.RegionType =3D "FILE" > > - RegionObj.RegionDataList.append( self.__Token) > > + RegionObj.RegionDataList.append(self._Token) > > > > - while self.__IsKeyword( "FILE"): > > + while self._IsKeyword("FILE"): > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FILE name", self.FileName, sel= f.CurrentLineNumber) > > > > - RegionObj.RegionDataList.append(self.__Token) > > + RegionObj.RegionDataList.append(self._Token) > > > > - ## __GetRegionDataType() method > > + ## _GetRegionDataType() method > > # > > # Get region array data for region > > # > > # @param self The object pointer > > # @param RegionObj for whom region data is got > > # > > - def __GetRegionDataType(self, RegionObj): > > - > > - if not self.__IsKeyword( "DATA"): > > + def _GetRegionDataType(self, RegionObj): > > + if not self._IsKeyword("DATA"): > > raise Warning("expected Region Data type", self.FileName, = self.CurrentLineNumber) > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__IsToken( "{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.CurrentL= ineNumber) > > > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex byte", self.FileName, self.Cur= rentLineNumber) > > > > - if len(self.__Token) > 18: > > + if len(self._Token) > 18: > > raise Warning("Hex string can't be converted to a valid UI= NT64 value", self.FileName, self.CurrentLineNumber) > > > > # convert hex string value to byte hex string array > > - AllString =3D self.__Token > > + AllString =3D self._Token > > AllStrLen =3D len (AllString) > > DataString =3D "" > > while AllStrLen > 4: > > - DataString =3D DataString + "0x" + AllString[AllStrLen - 2= : AllStrLen] + "," > > + DataString =3D DataString + "0x" + AllString[AllStrLen - 2= : AllStrLen] + TAB_COMMA_SPLIT > > AllStrLen =3D AllStrLen - 2 > > - DataString =3D DataString + AllString[:AllStrLen] + "," > > + DataString =3D DataString + AllString[:AllStrLen] + TAB_COMMA_= SPLIT > > > > # byte value array > > - if len (self.__Token) <=3D 4: > > - while self.__IsToken(","): > > - if not self.__GetNextHexNumber(): > > + if len (self._Token) <=3D 4: > > + while self._IsToken(TAB_COMMA_SPLIT): > > + if not self._GetNextHexNumber(): > > raise Warning("Invalid Hex number", self.FileName,= self.CurrentLineNumber) > > - if len(self.__Token) > 4: > > + if len(self._Token) > 4: > > raise Warning("Hex byte(must be 2 digits) too long= ", self.FileName, self.CurrentLineNumber) > > - DataString +=3D self.__Token > > - DataString +=3D "," > > + DataString +=3D self._Token > > + DataString +=3D TAB_COMMA_SPLIT > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.CurrentL= ineNumber) > > > > - DataString =3D DataString.rstrip(",") > > + DataString =3D DataString.rstrip(TAB_COMMA_SPLIT) > > RegionObj.RegionType =3D "DATA" > > - RegionObj.RegionDataList.append( DataString) > > + RegionObj.RegionDataList.append(DataString) > > > > - while self.__IsKeyword( "DATA"): > > + while self._IsKeyword("DATA"): > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__IsToken( "{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex byte", self.FileName, self= .CurrentLineNumber) > > > > - if len(self.__Token) > 18: > > + if len(self._Token) > 18: > > raise Warning("Hex string can't be converted to a vali= d UINT64 value", self.FileName, self.CurrentLineNumber) > > > > # convert hex string value to byte hex string array > > - AllString =3D self.__Token > > + AllString =3D self._Token > > AllStrLen =3D len (AllString) > > DataString =3D "" > > while AllStrLen > 4: > > - DataString =3D DataString + "0x" + AllString[AllStrLen= - 2: AllStrLen] + "," > > + DataString =3D DataString + "0x" + AllString[AllStrLen= - 2: AllStrLen] + TAB_COMMA_SPLIT > > AllStrLen =3D AllStrLen - 2 > > - DataString =3D DataString + AllString[:AllStrLen] + "," > > + DataString =3D DataString + AllString[:AllStrLen] + TAB_CO= MMA_SPLIT > > > > # byte value array > > - if len (self.__Token) <=3D 4: > > - while self.__IsToken(","): > > - if not self.__GetNextHexNumber(): > > + if len (self._Token) <=3D 4: > > + while self._IsToken(TAB_COMMA_SPLIT): > > + if not self._GetNextHexNumber(): > > raise Warning("Invalid Hex number", self.FileN= ame, self.CurrentLineNumber) > > - if len(self.__Token) > 4: > > + if len(self._Token) > 4: > > raise Warning("Hex byte(must be 2 digits) too = long", self.FileName, self.CurrentLineNumber) > > - DataString +=3D self.__Token > > - DataString +=3D "," > > + DataString +=3D self._Token > > + DataString +=3D TAB_COMMA_SPLIT > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > > > - DataString =3D DataString.rstrip(",") > > - RegionObj.RegionDataList.append( DataString) > > + DataString =3D DataString.rstrip(TAB_COMMA_SPLIT) > > + RegionObj.RegionDataList.append(DataString) > > > > - ## __GetFv() method > > + ## _GetFv() method > > # > > # Get FV section contents and store its data into FV dictionary = of self.Profile > > # > > @@ -2125,68 +2067,68 @@ class FdfParser: > > # @retval True Successfully find a FV > > # @retval False Not able to find a FV > > # > > - def __GetFv(self): > > - if not self.__GetNextToken(): > > + def _GetFv(self): > > + if not self._GetNextToken(): > > return False > > > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[FV."): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[FV."= ): > > self.SectionParser(S) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - self.__UndoToken() > > - if not self.__IsToken("[FV.", True): > > + self._UndoToken() > > + if not self._IsToken("[FV.", True): > > FileLineTuple =3D GetRealFileLine(self.FileName, self.Curr= entLineNumber) > > #print 'Parsing String: %s in File %s, At line: %d, Offset= Within Line: %d' \ > > - # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > - raise Warning("Unknown Keyword '%s'" % self.__Token, self.= FileName, self.CurrentLineNumber) > > + # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > + raise Warning("Unknown Keyword '%s'" % self._Token, self.F= ileName, self.CurrentLineNumber) > > > > - FvName =3D self.__GetUiName() > > + FvName =3D self._GetUiName() > > self.CurrentFvName =3D FvName.upper() > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - FvObj =3D Fv.FV() > > + FvObj =3D FV() > > FvObj.UiFvName =3D self.CurrentFvName > > self.Profile.FvDict[self.CurrentFvName] =3D FvObj > > > > - Status =3D self.__GetCreateFile(FvObj) > > + Status =3D self._GetCreateFile(FvObj) > > if not Status: > > raise Warning("FV name error", self.FileName, self.Current= LineNumber) > > > > - self.__GetDefineStatements(FvObj) > > + self._GetDefineStatements(FvObj) > > > > - self.__GetAddressStatements(FvObj) > > + self._GetAddressStatements(FvObj) > > > > FvObj.FvExtEntryTypeValue =3D [] > > FvObj.FvExtEntryType =3D [] > > FvObj.FvExtEntryData =3D [] > > while True: > > - self.__GetSetStatements(FvObj) > > + self._GetSetStatements(FvObj) > > > > - if not (self.__GetBlockStatement(FvObj) or self.__GetFvBas= eAddress(FvObj) or > > - self.__GetFvForceRebase(FvObj) or self.__GetFvAlignmen= t(FvObj) or > > - self.__GetFvAttributes(FvObj) or self.__GetFvNameGuid(= FvObj) or > > - self.__GetFvExtEntryStatement(FvObj) or self.__GetFvNa= meString(FvObj)): > > + if not (self._GetBlockStatement(FvObj) or self._GetFvBaseA= ddress(FvObj) or > > + self._GetFvForceRebase(FvObj) or self._GetFvAlignment(= FvObj) or > > + self._GetFvAttributes(FvObj) or self._GetFvNameGuid(Fv= Obj) or > > + self._GetFvExtEntryStatement(FvObj) or self._GetFvName= String(FvObj)): > > break > > > > if FvObj.FvNameString =3D=3D 'TRUE' and not FvObj.FvNameGuid: > > raise Warning("FvNameString found but FvNameGuid was not f= ound", self.FileName, self.CurrentLineNumber) > > > > - self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy()) > > - self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy()) > > + self._GetAprioriSection(FvObj, FvObj.DefineVarDict.copy()) > > + self._GetAprioriSection(FvObj, FvObj.DefineVarDict.copy()) > > > > while True: > > - isInf =3D self.__GetInfStatement(FvObj) > > - isFile =3D self.__GetFileStatement(FvObj, MacroDict =3D Fv= Obj.DefineVarDict.copy()) > > + isInf =3D self._GetInfStatement(FvObj) > > + isFile =3D self._GetFileStatement(FvObj, MacroDict =3D FvO= bj.DefineVarDict.copy()) > > if not isInf and not isFile: > > break > > > > return True > > > > - ## __GetFvAlignment() method > > + ## _GetFvAlignment() method > > # > > # Get alignment for FV > > # > > @@ -2195,26 +2137,25 @@ class FdfParser: > > # @retval True Successfully find a alignment statement > > # @retval False Not able to find a alignment statement > > # > > - def __GetFvAlignment(self, Obj): > > - > > - if not self.__IsKeyword( "FvAlignment"): > > + def _GetFvAlignment(self, Obj): > > + if not self._IsKeyword("FvAlignment"): > > return False > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected alignment value", self.FileName, s= elf.CurrentLineNumber) > > > > - if self.__Token.upper() not in ("1", "2", "4", "8", "16", "32"= , "64", "128", "256", "512", \ > > + if self._Token.upper() not in ("1", "2", "4", "8", "16", "32",= "64", "128", "256", "512", \ > > "1K", "2K", "4K", "8K", "16K",= "32K", "64K", "128K", "256K", "512K", \ > > "1M", "2M", "4M", "8M", "16M",= "32M", "64M", "128M", "256M", "512M", \ > > "1G", "2G"): > > - raise Warning("Unknown alignment value '%s'" % self.__Toke= n, self.FileName, self.CurrentLineNumber) > > - Obj.FvAlignment =3D self.__Token > > + raise Warning("Unknown alignment value '%s'" % self._Token= , self.FileName, self.CurrentLineNumber) > > + Obj.FvAlignment =3D self._Token > > return True > > > > - ## __GetFvBaseAddress() method > > + ## _GetFvBaseAddress() method > > # > > # Get BaseAddress for FV > > # > > @@ -2223,23 +2164,22 @@ class FdfParser: > > # @retval True Successfully find a FvBaseAddress statemen= t > > # @retval False Not able to find a FvBaseAddress statement > > # > > - def __GetFvBaseAddress(self, Obj): > > - > > - if not self.__IsKeyword("FvBaseAddress"): > > + def _GetFvBaseAddress(self, Obj): > > + if not self._IsKeyword("FvBaseAddress"): > > return False > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FV base address value", self.FileN= ame, self.CurrentLineNumber) > > > > - if not BaseAddrValuePattern.match(self.__Token.upper()): > > - raise Warning("Unknown FV base address value '%s'" % self.= __Token, self.FileName, self.CurrentLineNumber) > > - Obj.FvBaseAddress =3D self.__Token > > + if not BaseAddrValuePattern.match(self._Token.upper()): > > + raise Warning("Unknown FV base address value '%s'" % self.= _Token, self.FileName, self.CurrentLineNumber) > > + Obj.FvBaseAddress =3D self._Token > > return True > > > > - ## __GetFvForceRebase() method > > + ## _GetFvForceRebase() method > > # > > # Get FvForceRebase for FV > > # > > @@ -2248,23 +2188,22 @@ class FdfParser: > > # @retval True Successfully find a FvForceRebase statemen= t > > # @retval False Not able to find a FvForceRebase statement > > # > > - def __GetFvForceRebase(self, Obj): > > - > > - if not self.__IsKeyword("FvForceRebase"): > > + def _GetFvForceRebase(self, Obj): > > + if not self._IsKeyword("FvForceRebase"): > > return False > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FvForceRebase value", self.FileNam= e, self.CurrentLineNumber) > > > > - if self.__Token.upper() not in ["TRUE", "FALSE", "0", "0X0", "= 0X00", "1", "0X1", "0X01"]: > > - raise Warning("Unknown FvForceRebase value '%s'" % self.__= Token, self.FileName, self.CurrentLineNumber) > > + if self._Token.upper() not in ["TRUE", "FALSE", "0", "0X0", "0= X00", "1", "0X1", "0X01"]: > > + raise Warning("Unknown FvForceRebase value '%s'" % self._T= oken, self.FileName, self.CurrentLineNumber) > > > > - if self.__Token.upper() in ["TRUE", "1", "0X1", "0X01"]: > > + if self._Token.upper() in ["TRUE", "1", "0X1", "0X01"]: > > Obj.FvForceRebase =3D True > > - elif self.__Token.upper() in ["FALSE", "0", "0X0", "0X00"]: > > + elif self._Token.upper() in ["FALSE", "0", "0X0", "0X00"]: > > Obj.FvForceRebase =3D False > > else: > > Obj.FvForceRebase =3D None > > @@ -2272,7 +2211,7 @@ class FdfParser: > > return True > > > > > > - ## __GetFvAttributes() method > > + ## _GetFvAttributes() method > > # > > # Get attributes for FV > > # > > @@ -2280,31 +2219,31 @@ class FdfParser: > > # @param Obj for whom attribute is got > > # @retval None > > # > > - def __GetFvAttributes(self, FvObj): > > + def _GetFvAttributes(self, FvObj): > > IsWordToken =3D False > > - while self.__GetNextWord(): > > + while self._GetNextWord(): > > IsWordToken =3D True > > - name =3D self.__Token > > + name =3D self._Token > > if name not in ("ERASE_POLARITY", "MEMORY_MAPPED", \ > > "STICKY_WRITE", "LOCK_CAP", "LOCK_STATUS", = "WRITE_ENABLED_CAP", \ > > "WRITE_DISABLED_CAP", "WRITE_STATUS", "READ= _ENABLED_CAP", \ > > "READ_DISABLED_CAP", "READ_STATUS", "READ_L= OCK_CAP", \ > > "READ_LOCK_STATUS", "WRITE_LOCK_CAP", "WRIT= E_LOCK_STATUS", \ > > "WRITE_POLICY_RELIABLE", "WEAK_ALIGNMENT", = "FvUsedSizeEnable"): > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken() or self.__Token.upper() not i= n ("TRUE", "FALSE", "1", "0"): > > + if not self._GetNextToken() or self._Token.upper() not in = ("TRUE", "FALSE", "1", "0"): > > raise Warning("expected TRUE/FALSE (1/0)", self.FileNa= me, self.CurrentLineNumber) > > > > - FvObj.FvAttributeDict[name] =3D self.__Token > > + FvObj.FvAttributeDict[name] =3D self._Token > > > > return IsWordToken > > > > - ## __GetFvNameGuid() method > > + ## _GetFvNameGuid() method > > # > > # Get FV GUID for FV > > # > > @@ -2312,110 +2251,107 @@ class FdfParser: > > # @param Obj for whom GUID is got > > # @retval None > > # > > - def __GetFvNameGuid(self, FvObj): > > - > > - if not self.__IsKeyword( "FvNameGuid"): > > + def _GetFvNameGuid(self, FvObj): > > + if not self._IsKeyword("FvNameGuid"): > > return False > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextGuid(): > > + if not self._GetNextGuid(): > > raise Warning("expected FV GUID value", self.FileName, sel= f.CurrentLineNumber) > > > > - FvObj.FvNameGuid =3D self.__Token > > + FvObj.FvNameGuid =3D self._Token > > > > return True > > > > - def __GetFvNameString(self, FvObj): > > - > > - if not self.__IsKeyword( "FvNameString"): > > + def _GetFvNameString(self, FvObj): > > + if not self._IsKeyword("FvNameString"): > > return False > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken() or self.__Token not in ('TRUE', '= FALSE'): > > + if not self._GetNextToken() or self._Token not in ('TRUE', 'FA= LSE'): > > raise Warning("expected TRUE or FALSE for FvNameString", s= elf.FileName, self.CurrentLineNumber) > > > > - FvObj.FvNameString =3D self.__Token > > + FvObj.FvNameString =3D self._Token > > > > return True > > > > - def __GetFvExtEntryStatement(self, FvObj): > > - > > - if not (self.__IsKeyword( "FV_EXT_ENTRY") or self.__IsKeyword(= "FV_EXT_ENTRY_TYPE")): > > + def _GetFvExtEntryStatement(self, FvObj): > > + if not (self._IsKeyword("FV_EXT_ENTRY") or self._IsKeyword("FV= _EXT_ENTRY_TYPE")): > > return False > > > > - if not self.__IsKeyword ("TYPE"): > > + if not self._IsKeyword ("TYPE"): > > raise Warning("expected 'TYPE'", self.FileName, self.Curre= ntLineNumber) > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextHexNumber() and not self.__GetNextDecimal= Number(): > > + if not self._GetNextHexNumber() and not self._GetNextDecimalNu= mber(): > > raise Warning("expected Hex FV extension entry type value = At Line ", self.FileName, self.CurrentLineNumber) > > > > - FvObj.FvExtEntryTypeValue.append(self.__Token) > > + FvObj.FvExtEntryTypeValue.append(self._Token) > > > > - if not self.__IsToken( "{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.CurrentL= ineNumber) > > > > - if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("DA= TA"): > > + if not self._IsKeyword ("FILE") and not self._IsKeyword ("DATA= "): > > raise Warning("expected 'FILE' or 'DATA'", self.FileName, = self.CurrentLineNumber) > > > > - FvObj.FvExtEntryType.append(self.__Token) > > + FvObj.FvExtEntryType.append(self._Token) > > > > - if self.__Token =3D=3D 'DATA': > > + if self._Token =3D=3D 'DATA': > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__IsToken( "{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex byte", self.FileName, self= .CurrentLineNumber) > > > > - if len(self.__Token) > 4: > > + if len(self._Token) > 4: > > raise Warning("Hex byte(must be 2 digits) too long", s= elf.FileName, self.CurrentLineNumber) > > > > - DataString =3D self.__Token > > - DataString +=3D "," > > + DataString =3D self._Token > > + DataString +=3D TAB_COMMA_SPLIT > > > > - while self.__IsToken(","): > > - if not self.__GetNextHexNumber(): > > + while self._IsToken(TAB_COMMA_SPLIT): > > + if not self._GetNextHexNumber(): > > raise Warning("Invalid Hex number", self.FileName,= self.CurrentLineNumber) > > - if len(self.__Token) > 4: > > + if len(self._Token) > 4: > > raise Warning("Hex byte(must be 2 digits) too long= ", self.FileName, self.CurrentLineNumber) > > - DataString +=3D self.__Token > > - DataString +=3D "," > > + DataString +=3D self._Token > > + DataString +=3D TAB_COMMA_SPLIT > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > > > - DataString =3D DataString.rstrip(",") > > + DataString =3D DataString.rstrip(TAB_COMMA_SPLIT) > > FvObj.FvExtEntryData.append(DataString) > > > > - if self.__Token =3D=3D 'FILE': > > + if self._Token =3D=3D 'FILE': > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FV Extension Entry file path A= t Line ", self.FileName, self.CurrentLineNumber) > > > > - FvObj.FvExtEntryData.append(self.__Token) > > + FvObj.FvExtEntryData.append(self._Token) > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > > > return True > > > > - ## __GetAprioriSection() method > > + ## _GetAprioriSection() method > > # > > # Get token statements > > # > > @@ -2425,56 +2361,55 @@ class FdfParser: > > # @retval True Successfully find apriori statement > > # @retval False Not able to find apriori statement > > # > > - def __GetAprioriSection(self, FvObj, MacroDict =3D {}): > > - > > - if not self.__IsKeyword( "APRIORI"): > > + def _GetAprioriSection(self, FvObj, MacroDict =3D {}): > > + if not self._IsKeyword("APRIORI"): > > return False > > > > - if not self.__IsKeyword("PEI") and not self.__IsKeyword("DXE")= : > > + if not self._IsKeyword("PEI") and not self._IsKeyword("DXE"): > > raise Warning("expected Apriori file type", self.FileName,= self.CurrentLineNumber) > > - AprType =3D self.__Token > > + AprType =3D self._Token > > > > - if not self.__IsToken( "{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.CurrentL= ineNumber) > > > > - AprSectionObj =3D AprioriSection.AprioriSection() > > + AprSectionObj =3D AprioriSection() > > AprSectionObj.AprioriType =3D AprType > > > > - self.__GetDefineStatements(AprSectionObj) > > + self._GetDefineStatements(AprSectionObj) > > MacroDict.update(AprSectionObj.DefineVarDict) > > > > while True: > > - IsInf =3D self.__GetInfStatement(AprSectionObj) > > - IsFile =3D self.__GetFileStatement( AprSectionObj) > > + IsInf =3D self._GetInfStatement(AprSectionObj) > > + IsFile =3D self._GetFileStatement(AprSectionObj) > > if not IsInf and not IsFile: > > break > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.CurrentL= ineNumber) > > > > FvObj.AprioriSectionList.append(AprSectionObj) > > return True > > > > - def __ParseInfStatement(self): > > - if not self.__IsKeyword("INF"): > > + def _ParseInfStatement(self): > > + if not self._IsKeyword("INF"): > > return None > > > > - ffsInf =3D FfsInfStatement.FfsInfStatement() > > - self.__GetInfOptions(ffsInf) > > + ffsInf =3D FfsInfStatement() > > + self._GetInfOptions(ffsInf) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected INF file path", self.FileName, sel= f.CurrentLineNumber) > > - ffsInf.InfFileName =3D self.__Token > > + ffsInf.InfFileName =3D self._Token > > if not ffsInf.InfFileName.endswith('.inf'): > > raise Warning("expected .inf file path", self.FileName, se= lf.CurrentLineNumber) > > > > ffsInf.CurrentLineNum =3D self.CurrentLineNumber > > - ffsInf.CurrentLineContent =3D self.__CurrentLine() > > + ffsInf.CurrentLineContent =3D self._CurrentLine() > > > > #Replace $(SAPCE) with real space > > ffsInf.InfFileName =3D ffsInf.InfFileName.replace('$(SPACE)', = ' ') > > > > - if ffsInf.InfFileName.replace('$(WORKSPACE)', '').find('$') = =3D=3D -1: > > + if ffsInf.InfFileName.replace(TAB_WORKSPACE, '').find('$') =3D= =3D -1: > > #do case sensitive check for file path > > ErrorCode, ErrorInfo =3D PathClass(NormPath(ffsInf.InfFile= Name), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > if ErrorCode !=3D 0: > > @@ -2492,16 +2427,16 @@ class FdfParser: > > else: > > self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFileN= ame) > > > > - if self.__IsToken('|'): > > - if self.__IsKeyword('RELOCS_STRIPPED'): > > + if self._IsToken(TAB_VALUE_SPLIT): > > + if self._IsKeyword('RELOCS_STRIPPED'): > > ffsInf.KeepReloc =3D False > > - elif self.__IsKeyword('RELOCS_RETAINED'): > > + elif self._IsKeyword('RELOCS_RETAINED'): > > ffsInf.KeepReloc =3D True > > else: > > - raise Warning("Unknown reloc strip flag '%s'" % self._= _Token, self.FileName, self.CurrentLineNumber) > > + raise Warning("Unknown reloc strip flag '%s'" % self._= Token, self.FileName, self.CurrentLineNumber) > > return ffsInf > > > > - ## __GetInfStatement() method > > + ## _GetInfStatement() method > > # > > # Get INF statements > > # > > @@ -2510,86 +2445,86 @@ class FdfParser: > > # @retval True Successfully find inf statement > > # @retval False Not able to find inf statement > > # > > - def __GetInfStatement(self, Obj, ForCapsule=3DFalse): > > - ffsInf =3D self.__ParseInfStatement() > > + def _GetInfStatement(self, Obj, ForCapsule=3DFalse): > > + ffsInf =3D self._ParseInfStatement() > > if not ffsInf: > > return False > > > > if ForCapsule: > > - capsuleFfs =3D CapsuleData.CapsuleFfs() > > - capsuleFfs.Ffs =3D ffsInf > > - Obj.CapsuleDataList.append(capsuleFfs) > > + myCapsuleFfs =3D CapsuleFfs() > > + myCapsuleFfs.Ffs =3D ffsInf > > + Obj.CapsuleDataList.append(myCapsuleFfs) > > else: > > Obj.FfsList.append(ffsInf) > > return True > > > > - ## __GetInfOptions() method > > + ## _GetInfOptions() method > > # > > # Get options for INF > > # > > # @param self The object pointer > > # @param FfsInfObj for whom option is got > > # > > - def __GetInfOptions(self, FfsInfObj): > > - if self.__IsKeyword("FILE_GUID"): > > - if not self.__IsToken("=3D"): > > + def _GetInfOptions(self, FfsInfObj): > > + if self._IsKeyword("FILE_GUID"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextGuid(): > > + if not self._GetNextGuid(): > > raise Warning("expected GUID value", self.FileName, se= lf.CurrentLineNumber) > > - FfsInfObj.OverrideGuid =3D self.__Token > > + FfsInfObj.OverrideGuid =3D self._Token > > > > - if self.__IsKeyword( "RuleOverride"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("RuleOverride"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Rule name", self.FileName, sel= f.CurrentLineNumber) > > - FfsInfObj.Rule =3D self.__Token > > + FfsInfObj.Rule =3D self._Token > > > > - if self.__IsKeyword( "VERSION"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("VERSION"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Version", self.FileName, self.= CurrentLineNumber) > > > > - if self.__GetStringData(): > > - FfsInfObj.Version =3D self.__Token > > + if self._GetStringData(): > > + FfsInfObj.Version =3D self._Token > > > > - if self.__IsKeyword( BINARY_FILE_TYPE_UI): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword(BINARY_FILE_TYPE_UI): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected UI name", self.FileName, self.= CurrentLineNumber) > > > > - if self.__GetStringData(): > > - FfsInfObj.Ui =3D self.__Token > > + if self._GetStringData(): > > + FfsInfObj.Ui =3D self._Token > > > > - if self.__IsKeyword( "USE"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("USE"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected ARCH name", self.FileName, sel= f.CurrentLineNumber) > > - FfsInfObj.UseArch =3D self.__Token > > + FfsInfObj.UseArch =3D self._Token > > > > > > - if self.__GetNextToken(): > > - p =3D > re.compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CH= AIN_TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\))') > > - if p.match(self.__Token) and p.match(self.__Token).span()[= 1] =3D=3D len(self.__Token): > > - FfsInfObj.KeyStringList.append(self.__Token) > > - if not self.__IsToken(","): > > + if self._GetNextToken(): > > + p =3D > compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHAIN= _TAG\)|\*)_([a-zA-Z0-9\-]+|\$\(ARCH\))') > > + if p.match(self._Token) and p.match(self._Token).span()[1]= =3D=3D len(self._Token): > > + FfsInfObj.KeyStringList.append(self._Token) > > + if not self._IsToken(TAB_COMMA_SPLIT): > > return > > else: > > - self.__UndoToken() > > + self._UndoToken() > > return > > > > - while self.__GetNextToken(): > > - if not p.match(self.__Token): > > + while self._GetNextToken(): > > + if not p.match(self._Token): > > raise Warning("expected KeyString \"Target_Tag_Arc= h\"", self.FileName, self.CurrentLineNumber) > > - FfsInfObj.KeyStringList.append(self.__Token) > > + FfsInfObj.KeyStringList.append(self._Token) > > > > - if not self.__IsToken(","): > > + if not self._IsToken(TAB_COMMA_SPLIT): > > break > > > > - ## __GetFileStatement() method > > + ## _GetFileStatement() method > > # > > # Get FILE statements > > # > > @@ -2599,42 +2534,41 @@ class FdfParser: > > # @retval True Successfully find FILE statement > > # @retval False Not able to find FILE statement > > # > > - def __GetFileStatement(self, Obj, ForCapsule =3D False, MacroDict = =3D {}): > > - > > - if not self.__IsKeyword( "FILE"): > > + def _GetFileStatement(self, Obj, ForCapsule =3D False, MacroDict = =3D {}): > > + if not self._IsKeyword("FILE"): > > return False > > > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > raise Warning("expected FFS type", self.FileName, self.Cur= rentLineNumber) > > > > - if ForCapsule and self.__Token =3D=3D 'DATA': > > - self.__UndoToken() > > - self.__UndoToken() > > + if ForCapsule and self._Token =3D=3D 'DATA': > > + self._UndoToken() > > + self._UndoToken() > > return False > > > > - FfsFileObj =3D FfsFileStatement.FileStatement() > > - FfsFileObj.FvFileType =3D self.__Token > > + FfsFileObj =3D FileStatement() > > + FfsFileObj.FvFileType =3D self._Token > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextGuid(): > > - if not self.__GetNextWord(): > > + if not self._GetNextGuid(): > > + if not self._GetNextWord(): > > raise Warning("expected File GUID", self.FileName, sel= f.CurrentLineNumber) > > - if self.__Token =3D=3D 'PCD': > > - if not self.__IsToken( "("): > > + if self._Token =3D=3D 'PCD': > > + if not self._IsToken("("): > > raise Warning("expected '('", self.FileName, self.= CurrentLineNumber) > > - PcdPair =3D self.__GetNextPcdSettings() > > - if not self.__IsToken( ")"): > > + PcdPair =3D self._GetNextPcdSettings() > > + if not self._IsToken(")"): > > raise Warning("expected ')'", self.FileName, self.= CurrentLineNumber) > > - self.__Token =3D 'PCD('+PcdPair[1]+'.'+PcdPair[0]+')' > > + self._Token =3D 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]= +')' > > > > - FfsFileObj.NameGuid =3D self.__Token > > + FfsFileObj.NameGuid =3D self._Token > > > > - self.__GetFilePart( FfsFileObj, MacroDict.copy()) > > + self._GetFilePart(FfsFileObj, MacroDict.copy()) > > > > if ForCapsule: > > - capsuleFfs =3D CapsuleData.CapsuleFfs() > > + capsuleFfs =3D CapsuleFfs() > > capsuleFfs.Ffs =3D FfsFileObj > > Obj.CapsuleDataList.append(capsuleFfs) > > else: > > @@ -2642,7 +2576,7 @@ class FdfParser: > > > > return True > > > > - ## __FileCouldHaveRelocFlag() method > > + ## _FileCouldHaveRelocFlag() method > > # > > # Check whether reloc strip flag can be set for a file type. > > # > > @@ -2651,13 +2585,13 @@ class FdfParser: > > # @retval False No way to have it > > # > > @staticmethod > > - def __FileCouldHaveRelocFlag (FileType): > > + def _FileCouldHaveRelocFlag (FileType): > > if FileType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODUL= E_PEIM, 'PEI_DXE_COMBO'): > > return True > > else: > > return False > > > > - ## __SectionCouldHaveRelocFlag() method > > + ## _SectionCouldHaveRelocFlag() method > > # > > # Check whether reloc strip flag can be set for a section type. > > # > > @@ -2666,13 +2600,13 @@ class FdfParser: > > # @retval False No way to have it > > # > > @staticmethod > > - def __SectionCouldHaveRelocFlag (SectionType): > > + def _SectionCouldHaveRelocFlag (SectionType): > > if SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32)= : > > return True > > else: > > return False > > > > - ## __GetFilePart() method > > + ## _GetFilePart() method > > # > > # Get components for FILE statement > > # > > @@ -2680,58 +2614,57 @@ class FdfParser: > > # @param FfsFileObj for whom component is got > > # @param MacroDict dictionary used to replace macro > > # > > - def __GetFilePart(self, FfsFileObj, MacroDict =3D {}): > > + def _GetFilePart(self, FfsFileObj, MacroDict =3D {}): > > + self._GetFileOpts(FfsFileObj) > > > > - self.__GetFileOpts( FfsFileObj) > > - > > - if not self.__IsToken("{"): > > - if self.__IsKeyword('RELOCS_STRIPPED') or self.__IsKeyword= ('RELOCS_RETAINED'): > > - if self.__FileCouldHaveRelocFlag(FfsFileObj.FvFileType= ): > > - if self.__Token =3D=3D 'RELOCS_STRIPPED': > > + if not self._IsToken("{"): > > + if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('= RELOCS_RETAINED'): > > + if self._FileCouldHaveRelocFlag(FfsFileObj.FvFileType)= : > > + if self._Token =3D=3D 'RELOCS_STRIPPED': > > FfsFileObj.KeepReloc =3D False > > else: > > FfsFileObj.KeepReloc =3D True > > else: > > raise Warning("File type %s could not have reloc s= trip flag%d" % (FfsFileObj.FvFileType, > self.CurrentLineNumber), self.FileName, self.CurrentLineNumber) > > > > - if not self.__IsToken("{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected File name or section data", self.F= ileName, self.CurrentLineNumber) > > > > - if self.__Token =3D=3D BINARY_FILE_TYPE_FV: > > - if not self.__IsToken( "=3D"): > > + if self._Token =3D=3D BINARY_FILE_TYPE_FV: > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FV name", self.FileName, self.= CurrentLineNumber) > > - FfsFileObj.FvName =3D self.__Token > > + FfsFileObj.FvName =3D self._Token > > > > - elif self.__Token =3D=3D "FD": > > - if not self.__IsToken( "=3D"): > > + elif self._Token =3D=3D "FD": > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FD name", self.FileName, self.= CurrentLineNumber) > > - FfsFileObj.FdName =3D self.__Token > > + FfsFileObj.FdName =3D self._Token > > > > - elif self.__Token in ("DEFINE", "APRIORI", "SECTION"): > > - self.__UndoToken() > > - self.__GetSectionData( FfsFileObj, MacroDict) > > + elif self._Token in (TAB_DEFINE, "APRIORI", "SECTION"): > > + self._UndoToken() > > + self._GetSectionData(FfsFileObj, MacroDict) > > > > elif hasattr(FfsFileObj, 'FvFileType') and FfsFileObj.FvFileTy= pe =3D=3D 'RAW': > > - self.__UndoToken() > > - self.__GetRAWData(FfsFileObj, MacroDict) > > + self._UndoToken() > > + self._GetRAWData(FfsFileObj, MacroDict) > > > > else: > > FfsFileObj.CurrentLineNum =3D self.CurrentLineNumber > > - FfsFileObj.CurrentLineContent =3D self.__CurrentLine() > > - FfsFileObj.FileName =3D self.__Token.replace('$(SPACE)', '= ') > > - self.__VerifyFile(FfsFileObj.FileName) > > + FfsFileObj.CurrentLineContent =3D self._CurrentLine() > > + FfsFileObj.FileName =3D self._Token.replace('$(SPACE)', ' = ') > > + self._VerifyFile(FfsFileObj.FileName) > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.CurrentL= ineNumber) > > > > - ## __GetRAWData() method > > + ## _GetRAWData() method > > # > > # Get RAW data for FILE statement > > # > > @@ -2739,33 +2672,32 @@ class FdfParser: > > # @param FfsFileObj for whom section is got > > # @param MacroDict dictionary used to replace macro > > # > > - def __GetRAWData(self, FfsFileObj, MacroDict =3D {}): > > + def _GetRAWData(self, FfsFileObj, MacroDict =3D {}): > > FfsFileObj.FileName =3D [] > > FfsFileObj.SubAlignment =3D [] > > while True: > > AlignValue =3D None > > - if self.__GetAlignment(): > > - if self.__Token not in ("Auto", "8", "16", "32", "64",= "128", "512", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M", "4= M", "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % self.__= Token, self.FileName, self.CurrentLineNumber) > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENTS: > > + raise Warning("Incorrect alignment '%s'" % self._T= oken, self.FileName, self.CurrentLineNumber) > > #For FFS, Auto is default option same to "" > > - if not self.__Token =3D=3D "Auto": > > - AlignValue =3D self.__Token > > - if not self.__GetNextToken(): > > + if not self._Token =3D=3D "Auto": > > + AlignValue =3D self._Token > > + if not self._GetNextToken(): > > raise Warning("expected Filename value", self.FileName= , self.CurrentLineNumber) > > > > - FileName =3D self.__Token.replace('$(SPACE)', ' ') > > + FileName =3D self._Token.replace('$(SPACE)', ' ') > > if FileName =3D=3D '}': > > - self.__UndoToken() > > + self._UndoToken() > > raise Warning("expected Filename value", self.FileName= , self.CurrentLineNumber) > > > > - self.__VerifyFile(FileName) > > + self._VerifyFile(FileName) > > File =3D PathClass(NormPath(FileName), GenFdsGlobalVariabl= e.WorkSpaceDir) > > FfsFileObj.FileName.append(File.Path) > > FfsFileObj.SubAlignment.append(AlignValue) > > > > - if self.__IsToken( "}"): > > - self.__UndoToken() > > + if self._IsToken("}"): > > + self._UndoToken() > > break > > > > if len(FfsFileObj.SubAlignment) =3D=3D 1: > > @@ -2773,45 +2705,43 @@ class FdfParser: > > if len(FfsFileObj.FileName) =3D=3D 1: > > FfsFileObj.FileName =3D FfsFileObj.FileName[0] > > > > - ## __GetFileOpts() method > > + ## _GetFileOpts() method > > # > > # Get options for FILE statement > > # > > # @param self The object pointer > > # @param FfsFileObj for whom options is got > > # > > - def __GetFileOpts(self, FfsFileObj): > > - > > - if self.__GetNextToken(): > > - if TokenFindPattern.match(self.__Token): > > - FfsFileObj.KeyStringList.append(self.__Token) > > - if self.__IsToken(","): > > - while self.__GetNextToken(): > > - if not TokenFindPattern.match(self.__Token): > > + def _GetFileOpts(self, FfsFileObj): > > + if self._GetNextToken(): > > + if TokenFindPattern.match(self._Token): > > + FfsFileObj.KeyStringList.append(self._Token) > > + if self._IsToken(TAB_COMMA_SPLIT): > > + while self._GetNextToken(): > > + if not TokenFindPattern.match(self._Token): > > raise Warning("expected KeyString \"Target= _Tag_Arch\"", self.FileName, self.CurrentLineNumber) > > - FfsFileObj.KeyStringList.append(self.__Token) > > + FfsFileObj.KeyStringList.append(self._Token) > > > > - if not self.__IsToken(","): > > + if not self._IsToken(TAB_COMMA_SPLIT): > > break > > > > else: > > - self.__UndoToken() > > + self._UndoToken() > > > > - if self.__IsKeyword( "FIXED", True): > > + if self._IsKeyword("FIXED", True): > > FfsFileObj.Fixed =3D True > > > > - if self.__IsKeyword( "CHECKSUM", True): > > + if self._IsKeyword("CHECKSUM", True): > > FfsFileObj.CheckSum =3D True > > > > - if self.__GetAlignment(): > > - if self.__Token not in ("Auto", "8", "16", "32", "64", "12= 8", "512", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M", "4M", = "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % self.__Toke= n, self.FileName, self.CurrentLineNumber) > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENTS: > > + raise Warning("Incorrect alignment '%s'" % self._Token= , self.FileName, self.CurrentLineNumber) > > #For FFS, Auto is default option same to "" > > - if not self.__Token =3D=3D "Auto": > > - FfsFileObj.Alignment =3D self.__Token > > + if not self._Token =3D=3D "Auto": > > + FfsFileObj.Alignment =3D self._Token > > > > - ## __GetAlignment() method > > + ## _GetAlignment() method > > # > > # Return the alignment value > > # > > @@ -2819,18 +2749,18 @@ class FdfParser: > > # @retval True Successfully find alignment > > # @retval False Not able to find alignment > > # > > - def __GetAlignment(self): > > - if self.__IsKeyword( "Align", True): > > - if not self.__IsToken( "=3D"): > > + def _GetAlignment(self): > > + if self._IsKeyword("Align", True): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected alignment value", self.FileNam= e, self.CurrentLineNumber) > > return True > > > > return False > > > > - ## __GetFilePart() method > > + ## _GetFilePart() method > > # > > # Get section data for FILE statement > > # > > @@ -2838,23 +2768,23 @@ class FdfParser: > > # @param FfsFileObj for whom section is got > > # @param MacroDict dictionary used to replace macro > > # > > - def __GetSectionData(self, FfsFileObj, MacroDict =3D {}): > > + def _GetSectionData(self, FfsFileObj, MacroDict =3D {}): > > Dict =3D {} > > Dict.update(MacroDict) > > > > - self.__GetDefineStatements(FfsFileObj) > > + self._GetDefineStatements(FfsFileObj) > > > > Dict.update(FfsFileObj.DefineVarDict) > > - self.__GetAprioriSection(FfsFileObj, Dict.copy()) > > - self.__GetAprioriSection(FfsFileObj, Dict.copy()) > > + self._GetAprioriSection(FfsFileObj, Dict.copy()) > > + self._GetAprioriSection(FfsFileObj, Dict.copy()) > > > > while True: > > - IsLeafSection =3D self.__GetLeafSection(FfsFileObj, Dict) > > - IsEncapSection =3D self.__GetEncapsulationSec(FfsFileObj) > > + IsLeafSection =3D self._GetLeafSection(FfsFileObj, Dict) > > + IsEncapSection =3D self._GetEncapsulationSec(FfsFileObj) > > if not IsLeafSection and not IsEncapSection: > > break > > > > - ## __GetLeafSection() method > > + ## _GetLeafSection() method > > # > > # Get leaf section for Obj > > # > > @@ -2864,97 +2794,95 @@ class FdfParser: > > # @retval True Successfully find section statement > > # @retval False Not able to find section statement > > # > > - def __GetLeafSection(self, Obj, MacroDict =3D {}): > > - > > + def _GetLeafSection(self, Obj, MacroDict =3D {}): > > OldPos =3D self.GetFileBufferPos() > > > > - if not self.__IsKeyword( "SECTION"): > > + if not self._IsKeyword("SECTION"): > > if len(Obj.SectionList) =3D=3D 0: > > raise Warning("expected SECTION", self.FileName, self.= CurrentLineNumber) > > else: > > return False > > > > AlignValue =3D None > > - if self.__GetAlignment(): > > - if self.__Token not in ("Auto", "8", "16", "32", "64", "12= 8", "512", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M", "4M", = "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % self.__Toke= n, self.FileName, self.CurrentLineNumber) > > - AlignValue =3D self.__Token > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENTS: > > + raise Warning("Incorrect alignment '%s'" % self._Token= , self.FileName, self.CurrentLineNumber) > > + AlignValue =3D self._Token > > > > BuildNum =3D None > > - if self.__IsKeyword( "BUILD_NUM"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("BUILD_NUM"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Build number value", self.File= Name, self.CurrentLineNumber) > > > > - BuildNum =3D self.__Token > > + BuildNum =3D self._Token > > > > - if self.__IsKeyword( "VERSION"): > > + if self._IsKeyword("VERSION"): > > if AlignValue =3D=3D 'Auto': > > raise Warning("Auto alignment can only be used in PE32= or TE section ", self.FileName, self.CurrentLineNumber) > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected version", self.FileName, self.= CurrentLineNumber) > > - VerSectionObj =3D VerSection.VerSection() > > + VerSectionObj =3D VerSection() > > VerSectionObj.Alignment =3D AlignValue > > VerSectionObj.BuildNum =3D BuildNum > > - if self.__GetStringData(): > > - VerSectionObj.StringData =3D self.__Token > > + if self._GetStringData(): > > + VerSectionObj.StringData =3D self._Token > > else: > > - VerSectionObj.FileName =3D self.__Token > > + VerSectionObj.FileName =3D self._Token > > Obj.SectionList.append(VerSectionObj) > > > > - elif self.__IsKeyword( BINARY_FILE_TYPE_UI): > > + elif self._IsKeyword(BINARY_FILE_TYPE_UI): > > if AlignValue =3D=3D 'Auto': > > raise Warning("Auto alignment can only be used in PE32= or TE section ", self.FileName, self.CurrentLineNumber) > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected UI", self.FileName, self.Curre= ntLineNumber) > > - UiSectionObj =3D UiSection.UiSection() > > + UiSectionObj =3D UiSection() > > UiSectionObj.Alignment =3D AlignValue > > - if self.__GetStringData(): > > - UiSectionObj.StringData =3D self.__Token > > + if self._GetStringData(): > > + UiSectionObj.StringData =3D self._Token > > else: > > - UiSectionObj.FileName =3D self.__Token > > + UiSectionObj.FileName =3D self._Token > > Obj.SectionList.append(UiSectionObj) > > > > - elif self.__IsKeyword( "FV_IMAGE"): > > + elif self._IsKeyword("FV_IMAGE"): > > if AlignValue =3D=3D 'Auto': > > raise Warning("Auto alignment can only be used in PE32= or TE section ", self.FileName, self.CurrentLineNumber) > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FV name or FV file path", self= .FileName, self.CurrentLineNumber) > > > > - FvName =3D self.__Token > > + FvName =3D self._Token > > FvObj =3D None > > > > - if self.__IsToken( "{"): > > - FvObj =3D Fv.FV() > > + if self._IsToken("{"): > > + FvObj =3D FV() > > FvObj.UiFvName =3D FvName.upper() > > - self.__GetDefineStatements(FvObj) > > + self._GetDefineStatements(FvObj) > > MacroDict.update(FvObj.DefineVarDict) > > - self.__GetBlockStatement(FvObj) > > - self.__GetSetStatements(FvObj) > > - self.__GetFvAlignment(FvObj) > > - self.__GetFvAttributes(FvObj) > > - self.__GetAprioriSection(FvObj, MacroDict.copy()) > > - self.__GetAprioriSection(FvObj, MacroDict.copy()) > > + self._GetBlockStatement(FvObj) > > + self._GetSetStatements(FvObj) > > + self._GetFvAlignment(FvObj) > > + self._GetFvAttributes(FvObj) > > + self._GetAprioriSection(FvObj, MacroDict.copy()) > > + self._GetAprioriSection(FvObj, MacroDict.copy()) > > > > while True: > > - IsInf =3D self.__GetInfStatement(FvObj) > > - IsFile =3D self.__GetFileStatement(FvObj, MacroDic= t.copy()) > > + IsInf =3D self._GetInfStatement(FvObj) > > + IsFile =3D self._GetFileStatement(FvObj, MacroDict= .copy()) > > if not IsInf and not IsFile: > > break > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.= CurrentLineNumber) > > > > - FvImageSectionObj =3D FvImageSection.FvImageSection() > > + FvImageSectionObj =3D FvImageSection() > > FvImageSectionObj.Alignment =3D AlignValue > > if FvObj is not None: > > FvImageSectionObj.Fv =3D FvObj > > @@ -2965,81 +2893,81 @@ class FdfParser: > > > > Obj.SectionList.append(FvImageSectionObj) > > > > - elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DX= E_DEPEX_EXP") or self.__IsKeyword("SMM_DEPEX_EXP"): > > + elif self._IsKeyword("PEI_DEPEX_EXP") or self._IsKeyword("DXE_= DEPEX_EXP") or self._IsKeyword("SMM_DEPEX_EXP"): > > if AlignValue =3D=3D 'Auto': > > raise Warning("Auto alignment can only be used in PE32= or TE section ", self.FileName, self.CurrentLineNumber) > > - DepexSectionObj =3D DepexSection.DepexSection() > > + DepexSectionObj =3D DepexSection() > > DepexSectionObj.Alignment =3D AlignValue > > - DepexSectionObj.DepexType =3D self.__Token > > + DepexSectionObj.DepexType =3D self._Token > > > > - if not self.__IsToken( "=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__IsToken( "{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > - if not self.__SkipToToken( "}"): > > + if not self._SkipToToken("}"): > > raise Warning("expected Depex expression ending '}'", = self.FileName, self.CurrentLineNumber) > > > > - DepexSectionObj.Expression =3D self.__SkippedChars.rstrip(= '}') > > + DepexSectionObj.Expression =3D self._SkippedChars.rstrip('= }') > > Obj.SectionList.append(DepexSectionObj) > > > > else: > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > raise Warning("expected section type", self.FileName, = self.CurrentLineNumber) > > > > # Encapsulation section appear, UndoToken and return > > - if self.__Token =3D=3D "COMPRESS" or self.__Token =3D=3D "= GUIDED": > > + if self._Token =3D=3D "COMPRESS" or self._Token =3D=3D "GU= IDED": > > self.SetFileBufferPos(OldPos) > > return False > > > > - if self.__Token not in ("COMPAT16", BINARY_FILE_TYPE_PE32,= BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > + if self._Token not in ("COMPAT16", BINARY_FILE_TYPE_PE32, = BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > BINARY_FILE_TYPE_UI, "VERSION", BINARY_= FILE_TYPE_PEI_DEPEX, "SUBTYPE_GUID", > BINARY_FILE_TYPE_SMM_DEPEX): > > - raise Warning("Unknown section type '%s'" % self.__Tok= en, self.FileName, self.CurrentLineNumber) > > - if AlignValue =3D=3D 'Auto'and (not self.__Token =3D=3D BI= NARY_FILE_TYPE_PE32) and (not self.__Token =3D=3D > BINARY_FILE_TYPE_TE): > > + raise Warning("Unknown section type '%s'" % self._Toke= n, self.FileName, self.CurrentLineNumber) > > + if AlignValue =3D=3D 'Auto'and (not self._Token =3D=3D BIN= ARY_FILE_TYPE_PE32) and (not self._Token =3D=3D > BINARY_FILE_TYPE_TE): > > raise Warning("Auto alignment can only be used in PE32= or TE section ", self.FileName, self.CurrentLineNumber) > > > > # DataSection > > - DataSectionObj =3D DataSection.DataSection() > > + DataSectionObj =3D DataSection() > > DataSectionObj.Alignment =3D AlignValue > > - DataSectionObj.SecType =3D self.__Token > > + DataSectionObj.SecType =3D self._Token > > > > - if self.__IsKeyword('RELOCS_STRIPPED') or self.__IsKeyword= ('RELOCS_RETAINED'): > > - if self.__FileCouldHaveRelocFlag(Obj.FvFileType) and s= elf.__SectionCouldHaveRelocFlag(DataSectionObj.SecType): > > - if self.__Token =3D=3D 'RELOCS_STRIPPED': > > + if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('= RELOCS_RETAINED'): > > + if self._FileCouldHaveRelocFlag(Obj.FvFileType) and se= lf._SectionCouldHaveRelocFlag(DataSectionObj.SecType): > > + if self._Token =3D=3D 'RELOCS_STRIPPED': > > DataSectionObj.KeepReloc =3D False > > else: > > DataSectionObj.KeepReloc =3D True > > else: > > raise Warning("File type %s, section type %s, coul= d not have reloc strip flag%d" % (Obj.FvFileType, > DataSectionObj.SecType, self.CurrentLineNumber), self.FileName, self.Curr= entLineNumber) > > > > - if self.__IsToken("=3D"): > > - if not self.__GetNextToken(): > > + if self._IsToken(TAB_EQUAL_SPLIT): > > + if not self._GetNextToken(): > > raise Warning("expected section file path", self.F= ileName, self.CurrentLineNumber) > > - DataSectionObj.SectFileName =3D self.__Token > > - self.__VerifyFile(DataSectionObj.SectFileName) > > + DataSectionObj.SectFileName =3D self._Token > > + self._VerifyFile(DataSectionObj.SectFileName) > > else: > > - if not self.__GetCglSection(DataSectionObj): > > + if not self._GetCglSection(DataSectionObj): > > return False > > > > Obj.SectionList.append(DataSectionObj) > > > > return True > > > > - ## __VerifyFile > > + ## _VerifyFile > > # > > # Check if file exists or not: > > # If current phase if GenFds, the file must exist; > > # If current phase is AutoGen and the file is not in $(OUTPUT= _DIRECTORY), the file must exist > > # @param FileName: File path to be verified. > > # > > - def __VerifyFile(self, FileName): > > - if FileName.replace('$(WORKSPACE)', '').find('$') !=3D -1: > > + def _VerifyFile(self, FileName): > > + if FileName.replace(TAB_WORKSPACE, '').find('$') !=3D -1: > > return > > - if not GlobalData.gAutoGenPhase or not self.__GetMacroValue("O= UTPUT_DIRECTORY") in FileName: > > + if not GlobalData.gAutoGenPhase or not self._GetMacroValue(TAB= _DSC_DEFINES_OUTPUT_DIRECTORY) in FileName: > > ErrorCode, ErrorInfo =3D PathClass(NormPath(FileName), Gen= FdsGlobalVariable.WorkSpaceDir).Validate() > > if ErrorCode !=3D 0: > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DError= Info) > > > > - ## __GetCglSection() method > > + ## _GetCglSection() method > > # > > # Get compressed or GUIDed section for Obj > > # > > @@ -3049,28 +2977,28 @@ class FdfParser: > > # @retval True Successfully find section statement > > # @retval False Not able to find section statement > > # > > - def __GetCglSection(self, Obj, AlignValue =3D None): > > + def _GetCglSection(self, Obj, AlignValue =3D None): > > > > - if self.__IsKeyword( "COMPRESS"): > > + if self._IsKeyword("COMPRESS"): > > type =3D "PI_STD" > > - if self.__IsKeyword("PI_STD") or self.__IsKeyword("PI_NONE= "): > > - type =3D self.__Token > > + if self._IsKeyword("PI_STD") or self._IsKeyword("PI_NONE")= : > > + type =3D self._Token > > > > - if not self.__IsToken("{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > > > - CompressSectionObj =3D CompressSection.CompressSection() > > + CompressSectionObj =3D CompressSection() > > CompressSectionObj.Alignment =3D AlignValue > > CompressSectionObj.CompType =3D type > > # Recursive sections... > > while True: > > - IsLeafSection =3D self.__GetLeafSection(CompressSectio= nObj) > > - IsEncapSection =3D self.__GetEncapsulationSec(Compress= SectionObj) > > + IsLeafSection =3D self._GetLeafSection(CompressSection= Obj) > > + IsEncapSection =3D self._GetEncapsulationSec(CompressS= ectionObj) > > if not IsLeafSection and not IsEncapSection: > > break > > > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > Obj.SectionList.append(CompressSectionObj) > > > > @@ -3079,15 +3007,15 @@ class FdfParser: > > > > return True > > > > - elif self.__IsKeyword( "GUIDED"): > > + elif self._IsKeyword("GUIDED"): > > GuidValue =3D None > > - if self.__GetNextGuid(): > > - GuidValue =3D self.__Token > > + if self._GetNextGuid(): > > + GuidValue =3D self._Token > > > > - AttribDict =3D self.__GetGuidAttrib() > > - if not self.__IsToken("{"): > > + AttribDict =3D self._GetGuidAttrib() > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > - GuidSectionObj =3D GuidSection.GuidSection() > > + GuidSectionObj =3D GuidSection() > > GuidSectionObj.Alignment =3D AlignValue > > GuidSectionObj.NameGuid =3D GuidValue > > GuidSectionObj.SectionType =3D "GUIDED" > > @@ -3096,12 +3024,12 @@ class FdfParser: > > GuidSectionObj.ExtraHeaderSize =3D AttribDict["EXTRA_HEADE= R_SIZE"] > > # Recursive sections... > > while True: > > - IsLeafSection =3D self.__GetLeafSection(GuidSectionObj= ) > > - IsEncapSection =3D self.__GetEncapsulationSec(GuidSect= ionObj) > > + IsLeafSection =3D self._GetLeafSection(GuidSectionObj) > > + IsEncapSection =3D self._GetEncapsulationSec(GuidSecti= onObj) > > if not IsLeafSection and not IsEncapSection: > > break > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > Obj.SectionList.append(GuidSectionObj) > > > > @@ -3109,44 +3037,43 @@ class FdfParser: > > > > return False > > > > - ## __GetGuidAttri() method > > + ## _GetGuidAttri() method > > # > > # Get attributes for GUID section > > # > > # @param self The object pointer > > # @retval AttribDict Dictionary of key-value pair of section at= tributes > > # > > - def __GetGuidAttrib(self): > > - > > + def _GetGuidAttrib(self): > > AttribDict =3D {} > > AttribDict["PROCESSING_REQUIRED"] =3D "NONE" > > AttribDict["AUTH_STATUS_VALID"] =3D "NONE" > > AttribDict["EXTRA_HEADER_SIZE"] =3D -1 > > - while self.__IsKeyword("PROCESSING_REQUIRED") or self.__IsKeyw= ord("AUTH_STATUS_VALID") \ > > - or self.__IsKeyword("EXTRA_HEADER_SIZE"): > > - AttribKey =3D self.__Token > > + while self._IsKeyword("PROCESSING_REQUIRED") or self._IsKeywor= d("AUTH_STATUS_VALID") \ > > + or self._IsKeyword("EXTRA_HEADER_SIZE"): > > + AttribKey =3D self._Token > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected TRUE(1)/FALSE(0)/Number", self= .FileName, self.CurrentLineNumber) > > elif AttribKey =3D=3D "EXTRA_HEADER_SIZE": > > Base =3D 10 > > - if self.__Token[0:2].upper() =3D=3D "0X": > > + if self._Token[0:2].upper() =3D=3D "0X": > > Base =3D 16 > > try: > > - AttribDict[AttribKey] =3D int(self.__Token, Base) > > + AttribDict[AttribKey] =3D int(self._Token, Base) > > continue > > except ValueError: > > raise Warning("expected Number", self.FileName, se= lf.CurrentLineNumber) > > - elif self.__Token.upper() not in ("TRUE", "FALSE", "1", "0= "): > > + elif self._Token.upper() not in ("TRUE", "FALSE", "1", "0"= ): > > raise Warning("expected TRUE/FALSE (1/0)", self.FileNa= me, self.CurrentLineNumber) > > - AttribDict[AttribKey] =3D self.__Token > > + AttribDict[AttribKey] =3D self._Token > > > > return AttribDict > > > > - ## __GetEncapsulationSec() method > > + ## _GetEncapsulationSec() method > > # > > # Get encapsulation section for FILE > > # > > @@ -3155,91 +3082,89 @@ class FdfParser: > > # @retval True Successfully find section statement > > # @retval False Not able to find section statement > > # > > - def __GetEncapsulationSec(self, FfsFileObj): > > - > > + def _GetEncapsulationSec(self, FfsFileObj): > > OldPos =3D self.GetFileBufferPos() > > - if not self.__IsKeyword( "SECTION"): > > + if not self._IsKeyword("SECTION"): > > if len(FfsFileObj.SectionList) =3D=3D 0: > > raise Warning("expected SECTION", self.FileName, self.= CurrentLineNumber) > > else: > > return False > > > > AlignValue =3D None > > - if self.__GetAlignment(): > > - if self.__Token not in ("8", "16", "32", "64", "128", "512= ", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M", "4M", = "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % self.__Toke= n, self.FileName, self.CurrentLineNumber) > > - AlignValue =3D self.__Token > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENT_NOAUTO: > > + raise Warning("Incorrect alignment '%s'" % self._Token= , self.FileName, self.CurrentLineNumber) > > + AlignValue =3D self._Token > > > > - if not self.__GetCglSection(FfsFileObj, AlignValue): > > + if not self._GetCglSection(FfsFileObj, AlignValue): > > self.SetFileBufferPos(OldPos) > > return False > > else: > > return True > > > > - def __GetFmp(self): > > - if not self.__GetNextToken(): > > + def _GetFmp(self): > > + if not self._GetNextToken(): > > return False > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[FMPPAYLOAD."): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[FMPP= AYLOAD."): > > self.SectionParser(S) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - self.__UndoToken() > > - self.__SkipToToken("[FMPPAYLOAD.", True) > > - FmpUiName =3D self.__GetUiName().upper() > > + self._UndoToken() > > + self._SkipToToken("[FMPPAYLOAD.", True) > > + FmpUiName =3D self._GetUiName().upper() > > if FmpUiName in self.Profile.FmpPayloadDict: > > raise Warning("Duplicated FMP UI name found: %s" % FmpUiNa= me, self.FileName, self.CurrentLineNumber) > > > > - FmpData =3D CapsuleData.CapsulePayload() > > + FmpData =3D CapsulePayload() > > FmpData.UiName =3D FmpUiName > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("The FMP payload section is empty!", self.Fi= leName, self.CurrentLineNumber) > > FmpKeyList =3D ['IMAGE_HEADER_INIT_VERSION', 'IMAGE_TYPE_ID', = 'IMAGE_INDEX', 'HARDWARE_INSTANCE', > 'CERTIFICATE_GUID', 'MONOTONIC_COUNT'] > > - while self.__Token in FmpKeyList: > > - Name =3D self.__Token > > + while self._Token in FmpKeyList: > > + Name =3D self._Token > > FmpKeyList.remove(Name) > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > if Name =3D=3D 'IMAGE_TYPE_ID': > > - if not self.__GetNextGuid(): > > + if not self._GetNextGuid(): > > raise Warning("expected GUID value for IMAGE_TYPE_= ID.", self.FileName, self.CurrentLineNumber) > > - FmpData.ImageTypeId =3D self.__Token > > + FmpData.ImageTypeId =3D self._Token > > elif Name =3D=3D 'CERTIFICATE_GUID': > > - if not self.__GetNextGuid(): > > + if not self._GetNextGuid(): > > raise Warning("expected GUID value for CERTIFICATE= _GUID.", self.FileName, self.CurrentLineNumber) > > - FmpData.Certificate_Guid =3D self.__Token > > - if uuid.UUID(FmpData.Certificate_Guid) !=3D EFI_CERT_T= YPE_RSA2048_SHA256_GUID and > uuid.UUID(FmpData.Certificate_Guid) !=3D EFI_CERT_TYPE_PKCS7_GUID: > > + FmpData.Certificate_Guid =3D self._Token > > + if UUID(FmpData.Certificate_Guid) !=3D EFI_CERT_TYPE_R= SA2048_SHA256_GUID and > UUID(FmpData.Certificate_Guid) !=3D EFI_CERT_TYPE_PKCS7_GUID: > > raise Warning("Only support EFI_CERT_TYPE_RSA2048_= SHA256_GUID or EFI_CERT_TYPE_PKCS7_GUID for > CERTIFICATE_GUID.", self.FileName, self.CurrentLineNumber) > > else: > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected value of %s" % Name, self.= FileName, self.CurrentLineNumber) > > - Value =3D self.__Token > > + Value =3D self._Token > > if Name =3D=3D 'IMAGE_HEADER_INIT_VERSION': > > - if FdfParser.__Verify(Name, Value, 'UINT8'): > > + if FdfParser._Verify(Name, Value, 'UINT8'): > > FmpData.Version =3D Value > > elif Name =3D=3D 'IMAGE_INDEX': > > - if FdfParser.__Verify(Name, Value, 'UINT8'): > > + if FdfParser._Verify(Name, Value, 'UINT8'): > > FmpData.ImageIndex =3D Value > > elif Name =3D=3D 'HARDWARE_INSTANCE': > > - if FdfParser.__Verify(Name, Value, 'UINT8'): > > + if FdfParser._Verify(Name, Value, 'UINT8'): > > FmpData.HardwareInstance =3D Value > > elif Name =3D=3D 'MONOTONIC_COUNT': > > - if FdfParser.__Verify(Name, Value, 'UINT64'): > > + if FdfParser._Verify(Name, Value, 'UINT64'): > > FmpData.MonotonicCount =3D Value > > if FmpData.MonotonicCount.upper().startswith('= 0X'): > > FmpData.MonotonicCount =3D (long)(FmpData.= MonotonicCount, 16) > > else: > > FmpData.MonotonicCount =3D (long)(FmpData.= MonotonicCount) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > break > > else: > > - self.__UndoToken() > > + self._UndoToken() > > > > if (FmpData.MonotonicCount and not FmpData.Certificate_Guid) o= r (not FmpData.MonotonicCount and > FmpData.Certificate_Guid): > > EdkLogger.error("FdfParser", FORMAT_INVALID, "CERTIFICATE_= GUID and MONOTONIC_COUNT must be work as a > pair.") > > @@ -3248,7 +3173,7 @@ class FdfParser: > > if FmpKeyList and 'IMAGE_TYPE_ID' in FmpKeyList: > > raise Warning("Missing keywords IMAGE_TYPE_ID in FMP paylo= ad section.", self.FileName, self.CurrentLineNumber) > > # get the Image file and Vendor code file > > - self.__GetFMPCapsuleData(FmpData) > > + self._GetFMPCapsuleData(FmpData) > > if not FmpData.ImageFile: > > raise Warning("Missing image file in FMP payload section."= , self.FileName, self.CurrentLineNumber) > > # check whether more than one Vendor code file > > @@ -3257,7 +3182,7 @@ class FdfParser: > > self.Profile.FmpPayloadDict[FmpUiName] =3D FmpData > > return True > > > > - ## __GetCapsule() method > > + ## _GetCapsule() method > > # > > # Get capsule section contents and store its data into capsule l= ist of self.Profile > > # > > @@ -3265,90 +3190,89 @@ class FdfParser: > > # @retval True Successfully find a capsule > > # @retval False Not able to find a capsule > > # > > - def __GetCapsule(self): > > - > > - if not self.__GetNextToken(): > > + def _GetCapsule(self): > > + if not self._GetNextToken(): > > return False > > > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[CAPSULE."): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[CAPS= ULE."): > > self.SectionParser(S) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - self.__UndoToken() > > - if not self.__IsToken("[CAPSULE.", True): > > + self._UndoToken() > > + if not self._IsToken("[CAPSULE.", True): > > FileLineTuple =3D GetRealFileLine(self.FileName, self.Curr= entLineNumber) > > #print 'Parsing String: %s in File %s, At line: %d, Offset= Within Line: %d' \ > > - # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > + # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > raise Warning("expected [Capsule.]", self.FileName, self.C= urrentLineNumber) > > > > - CapsuleObj =3D Capsule.Capsule() > > + CapsuleObj =3D Capsule() > > > > - CapsuleName =3D self.__GetUiName() > > + CapsuleName =3D self._GetUiName() > > if not CapsuleName: > > raise Warning("expected capsule name", self.FileName, self= .CurrentLineNumber) > > > > CapsuleObj.UiCapsuleName =3D CapsuleName.upper() > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - if self.__IsKeyword("CREATE_FILE"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("CREATE_FILE"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected file name", self.FileName, sel= f.CurrentLineNumber) > > > > - CapsuleObj.CreateFile =3D self.__Token > > + CapsuleObj.CreateFile =3D self._Token > > > > - self.__GetCapsuleStatements(CapsuleObj) > > + self._GetCapsuleStatements(CapsuleObj) > > self.Profile.CapsuleDict[CapsuleObj.UiCapsuleName] =3D Capsule= Obj > > return True > > > > - ## __GetCapsuleStatements() method > > + ## _GetCapsuleStatements() method > > # > > # Get statements for capsule > > # > > # @param self The object pointer > > # @param Obj for whom statements are got > > # > > - def __GetCapsuleStatements(self, Obj): > > - self.__GetCapsuleTokens(Obj) > > - self.__GetDefineStatements(Obj) > > - self.__GetSetStatements(Obj) > > - self.__GetCapsuleData(Obj) > > + def _GetCapsuleStatements(self, Obj): > > + self._GetCapsuleTokens(Obj) > > + self._GetDefineStatements(Obj) > > + self._GetSetStatements(Obj) > > + self._GetCapsuleData(Obj) > > > > - ## __GetCapsuleTokens() method > > + ## _GetCapsuleTokens() method > > # > > # Get token statements for capsule > > # > > # @param self The object pointer > > # @param Obj for whom token statements are got > > # > > - def __GetCapsuleTokens(self, Obj): > > - if not self.__GetNextToken(): > > + def _GetCapsuleTokens(self, Obj): > > + if not self._GetNextToken(): > > return False > > - while self.__Token in ("CAPSULE_GUID", "CAPSULE_HEADER_SIZE", = "CAPSULE_FLAGS", "OEM_CAPSULE_FLAGS", > "CAPSULE_HEADER_INIT_VERSION"): > > - Name =3D self.__Token.strip() > > - if not self.__IsToken("=3D"): > > + while self._Token in ("CAPSULE_GUID", "CAPSULE_HEADER_SIZE", "= CAPSULE_FLAGS", "OEM_CAPSULE_FLAGS", > "CAPSULE_HEADER_INIT_VERSION"): > > + Name =3D self._Token.strip() > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected value", self.FileName, self.Cu= rrentLineNumber) > > if Name =3D=3D 'CAPSULE_FLAGS': > > - if not self.__Token in ("PersistAcrossReset", "Populat= eSystemTable", "InitiateReset"): > > + if not self._Token in ("PersistAcrossReset", "Populate= SystemTable", "InitiateReset"): > > raise Warning("expected PersistAcrossReset, Popula= teSystemTable, or InitiateReset", self.FileName, > self.CurrentLineNumber) > > - Value =3D self.__Token.strip() > > - while self.__IsToken(","): > > - Value +=3D ',' > > - if not self.__GetNextToken(): > > + Value =3D self._Token.strip() > > + while self._IsToken(TAB_COMMA_SPLIT): > > + Value +=3D TAB_COMMA_SPLIT > > + if not self._GetNextToken(): > > raise Warning("expected value", self.FileName,= self.CurrentLineNumber) > > - if not self.__Token in ("PersistAcrossReset", "Pop= ulateSystemTable", "InitiateReset"): > > + if not self._Token in ("PersistAcrossReset", "Popu= lateSystemTable", "InitiateReset"): > > raise Warning("expected PersistAcrossReset, Po= pulateSystemTable, or InitiateReset", self.FileName, > self.CurrentLineNumber) > > - Value +=3D self.__Token.strip() > > + Value +=3D self._Token.strip() > > elif Name =3D=3D 'OEM_CAPSULE_FLAGS': > > - Value =3D self.__Token.strip() > > + Value =3D self._Token.strip() > > if not Value.upper().startswith('0X'): > > raise Warning("expected hex value between 0x0000 a= nd 0xFFFF", self.FileName, self.CurrentLineNumber) > > try: > > @@ -3357,51 +3281,49 @@ class FdfParser: > > raise Warning("expected hex value between 0x0000 a= nd 0xFFFF", self.FileName, self.CurrentLineNumber) > > if not 0x0000 <=3D Value <=3D 0xFFFF: > > raise Warning("expected hex value between 0x0000 a= nd 0xFFFF", self.FileName, self.CurrentLineNumber) > > - Value =3D self.__Token.strip() > > + Value =3D self._Token.strip() > > else: > > - Value =3D self.__Token.strip() > > + Value =3D self._Token.strip() > > Obj.TokensDict[Name] =3D Value > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > return False > > - self.__UndoToken() > > + self._UndoToken() > > > > - ## __GetCapsuleData() method > > + ## _GetCapsuleData() method > > # > > # Get capsule data for capsule > > # > > # @param self The object pointer > > # @param Obj for whom capsule data are got > > # > > - def __GetCapsuleData(self, Obj): > > - > > + def _GetCapsuleData(self, Obj): > > while True: > > - IsInf =3D self.__GetInfStatement(Obj, True) > > - IsFile =3D self.__GetFileStatement(Obj, True) > > - IsFv =3D self.__GetFvStatement(Obj) > > - IsFd =3D self.__GetFdStatement(Obj) > > - IsAnyFile =3D self.__GetAnyFileStatement(Obj) > > - IsAfile =3D self.__GetAfileStatement(Obj) > > - IsFmp =3D self.__GetFmpStatement(Obj) > > + IsInf =3D self._GetInfStatement(Obj, True) > > + IsFile =3D self._GetFileStatement(Obj, True) > > + IsFv =3D self._GetFvStatement(Obj) > > + IsFd =3D self._GetFdStatement(Obj) > > + IsAnyFile =3D self._GetAnyFileStatement(Obj) > > + IsAfile =3D self._GetAfileStatement(Obj) > > + IsFmp =3D self._GetFmpStatement(Obj) > > if not (IsInf or IsFile or IsFv or IsFd or IsAnyFile or Is= Afile or IsFmp): > > break > > > > - ## __GetFMPCapsuleData() method > > + ## _GetFMPCapsuleData() method > > # > > # Get capsule data for FMP capsule > > # > > # @param self The object pointer > > # @param Obj for whom capsule data are got > > # > > - def __GetFMPCapsuleData(self, Obj): > > - > > + def _GetFMPCapsuleData(self, Obj): > > while True: > > - IsFv =3D self.__GetFvStatement(Obj, True) > > - IsFd =3D self.__GetFdStatement(Obj, True) > > - IsAnyFile =3D self.__GetAnyFileStatement(Obj, True) > > + IsFv =3D self._GetFvStatement(Obj, True) > > + IsFd =3D self._GetFdStatement(Obj, True) > > + IsAnyFile =3D self._GetAnyFileStatement(Obj, True) > > if not (IsFv or IsFd or IsAnyFile): > > break > > > > - ## __GetFvStatement() method > > + ## _GetFvStatement() method > > # > > # Get FV for capsule > > # > > @@ -3410,32 +3332,31 @@ class FdfParser: > > # @retval True Successfully find a FV statement > > # @retval False Not able to find a FV statement > > # > > - def __GetFvStatement(self, CapsuleObj, FMPCapsule =3D False): > > - > > - if not self.__IsKeyword(BINARY_FILE_TYPE_FV): > > + def _GetFvStatement(self, CapsuleObj, FMPCapsule =3D False): > > + if not self._IsKeyword(BINARY_FILE_TYPE_FV): > > return False > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FV name", self.FileName, self.Curr= entLineNumber) > > > > - if self.__Token.upper() not in self.Profile.FvDict: > > + if self._Token.upper() not in self.Profile.FvDict: > > raise Warning("FV name does not exist", self.FileName, sel= f.CurrentLineNumber) > > > > - CapsuleFv =3D CapsuleData.CapsuleFv() > > - CapsuleFv.FvName =3D self.__Token > > + myCapsuleFv =3D CapsuleFv() > > + myCapsuleFv.FvName =3D self._Token > > if FMPCapsule: > > if not CapsuleObj.ImageFile: > > - CapsuleObj.ImageFile.append(CapsuleFv) > > + CapsuleObj.ImageFile.append(myCapsuleFv) > > else: > > - CapsuleObj.VendorCodeFile.append(CapsuleFv) > > + CapsuleObj.VendorCodeFile.append(myCapsuleFv) > > else: > > - CapsuleObj.CapsuleDataList.append(CapsuleFv) > > + CapsuleObj.CapsuleDataList.append(myCapsuleFv) > > return True > > > > - ## __GetFdStatement() method > > + ## _GetFdStatement() method > > # > > # Get FD for capsule > > # > > @@ -3444,74 +3365,73 @@ class FdfParser: > > # @retval True Successfully find a FD statement > > # @retval False Not able to find a FD statement > > # > > - def __GetFdStatement(self, CapsuleObj, FMPCapsule =3D False): > > - > > - if not self.__IsKeyword("FD"): > > + def _GetFdStatement(self, CapsuleObj, FMPCapsule =3D False): > > + if not self._IsKeyword("FD"): > > return False > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected FD name", self.FileName, self.Curr= entLineNumber) > > > > - if self.__Token.upper() not in self.Profile.FdDict: > > + if self._Token.upper() not in self.Profile.FdDict: > > raise Warning("FD name does not exist", self.FileName, sel= f.CurrentLineNumber) > > > > - CapsuleFd =3D CapsuleData.CapsuleFd() > > - CapsuleFd.FdName =3D self.__Token > > + myCapsuleFd =3D CapsuleFd() > > + myCapsuleFd.FdName =3D self._Token > > if FMPCapsule: > > if not CapsuleObj.ImageFile: > > - CapsuleObj.ImageFile.append(CapsuleFd) > > + CapsuleObj.ImageFile.append(myCapsuleFd) > > else: > > - CapsuleObj.VendorCodeFile.append(CapsuleFd) > > + CapsuleObj.VendorCodeFile.append(myCapsuleFd) > > else: > > - CapsuleObj.CapsuleDataList.append(CapsuleFd) > > + CapsuleObj.CapsuleDataList.append(myCapsuleFd) > > return True > > > > - def __GetFmpStatement(self, CapsuleObj): > > - if not self.__IsKeyword("FMP_PAYLOAD"): > > - if not self.__IsKeyword("FMP"): > > + def _GetFmpStatement(self, CapsuleObj): > > + if not self._IsKeyword("FMP_PAYLOAD"): > > + if not self._IsKeyword("FMP"): > > return False > > > > - if not self.__IsKeyword("PAYLOAD"): > > - self.__UndoToken() > > + if not self._IsKeyword("PAYLOAD"): > > + self._UndoToken() > > return False > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected payload name after FMP_PAYLOAD =3D= ", self.FileName, self.CurrentLineNumber) > > - Payload =3D self.__Token.upper() > > + Payload =3D self._Token.upper() > > if Payload not in self.Profile.FmpPayloadDict: > > - raise Warning("This FMP Payload does not exist: %s" % self= .__Token, self.FileName, self.CurrentLineNumber) > > + raise Warning("This FMP Payload does not exist: %s" % self= ._Token, self.FileName, self.CurrentLineNumber) > > CapsuleObj.FmpPayloadList.append(self.Profile.FmpPayloadDict[P= ayload]) > > return True > > > > - def __ParseRawFileStatement(self): > > - if not self.__IsKeyword("FILE"): > > + def _ParseRawFileStatement(self): > > + if not self._IsKeyword("FILE"): > > return None > > > > - if not self.__IsKeyword("DATA"): > > - self.__UndoToken() > > + if not self._IsKeyword("DATA"): > > + self._UndoToken() > > return None > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected File name", self.FileName, self.Cu= rrentLineNumber) > > > > - AnyFileName =3D self.__Token > > - self.__VerifyFile(AnyFileName) > > + AnyFileName =3D self._Token > > + self._VerifyFile(AnyFileName) > > > > if not os.path.isabs(AnyFileName): > > AnyFileName =3D mws.join(GenFdsGlobalVariable.WorkSpaceDir= , AnyFileName) > > > > return AnyFileName > > > > - ## __GetAnyFileStatement() method > > + ## _GetAnyFileStatement() method > > # > > # Get AnyFile for capsule > > # > > @@ -3520,23 +3440,23 @@ class FdfParser: > > # @retval True Successfully find a Anyfile statement > > # @retval False Not able to find a AnyFile statement > > # > > - def __GetAnyFileStatement(self, CapsuleObj, FMPCapsule =3D False): > > - AnyFileName =3D self.__ParseRawFileStatement() > > + def _GetAnyFileStatement(self, CapsuleObj, FMPCapsule =3D False): > > + AnyFileName =3D self._ParseRawFileStatement() > > if not AnyFileName: > > return False > > > > - CapsuleAnyFile =3D CapsuleData.CapsuleAnyFile() > > - CapsuleAnyFile.FileName =3D AnyFileName > > + myCapsuleAnyFile =3D CapsuleAnyFile() > > + myCapsuleAnyFile.FileName =3D AnyFileName > > if FMPCapsule: > > if not CapsuleObj.ImageFile: > > - CapsuleObj.ImageFile.append(CapsuleAnyFile) > > + CapsuleObj.ImageFile.append(myCapsuleAnyFile) > > else: > > - CapsuleObj.VendorCodeFile.append(CapsuleAnyFile) > > + CapsuleObj.VendorCodeFile.append(myCapsuleAnyFile) > > else: > > - CapsuleObj.CapsuleDataList.append(CapsuleAnyFile) > > + CapsuleObj.CapsuleDataList.append(myCapsuleAnyFile) > > return True > > > > - ## __GetAfileStatement() method > > + ## _GetAfileStatement() method > > # > > # Get Afile for capsule > > # > > @@ -3545,18 +3465,17 @@ class FdfParser: > > # @retval True Successfully find a Afile statement > > # @retval False Not able to find a Afile statement > > # > > - def __GetAfileStatement(self, CapsuleObj): > > - > > - if not self.__IsKeyword("APPEND"): > > + def _GetAfileStatement(self, CapsuleObj): > > + if not self._IsKeyword("APPEND"): > > return False > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Afile name", self.FileName, self.C= urrentLineNumber) > > > > - AfileName =3D self.__Token > > + AfileName =3D self._Token > > AfileBaseName =3D os.path.basename(AfileName) > > > > if os.path.splitext(AfileBaseName)[1] not in [".bin", ".BIN",= ".Bin", ".dat", ".DAT", ".Dat", ".data", ".DATA", ".Data"]: > > @@ -3565,19 +3484,19 @@ class FdfParser: > > > > if not os.path.isabs(AfileName): > > AfileName =3D GenFdsGlobalVariable.ReplaceWorkspaceMacro(A= fileName) > > - self.__VerifyFile(AfileName) > > + self._VerifyFile(AfileName) > > else: > > if not os.path.exists(AfileName): > > raise Warning('%s does not exist' % AfileName, self.Fi= leName, self.CurrentLineNumber) > > else: > > pass > > > > - CapsuleAfile =3D CapsuleData.CapsuleAfile() > > - CapsuleAfile.FileName =3D AfileName > > - CapsuleObj.CapsuleDataList.append(CapsuleAfile) > > + myCapsuleAfile =3D CapsuleAfile() > > + myCapsuleAfile.FileName =3D AfileName > > + CapsuleObj.CapsuleDataList.append(myCapsuleAfile) > > return True > > > > - ## __GetRule() method > > + ## _GetRule() method > > # > > # Get Rule section contents and store its data into rule list of= self.Profile > > # > > @@ -3585,143 +3504,140 @@ class FdfParser: > > # @retval True Successfully find a Rule > > # @retval False Not able to find a Rule > > # > > - def __GetRule(self): > > - > > - if not self.__GetNextToken(): > > + def _GetRule(self): > > + if not self._GetNextToken(): > > return False > > > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[RULE."): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[RULE= ."): > > self.SectionParser(S) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > - self.__UndoToken() > > - if not self.__IsToken("[Rule.", True): > > + self._UndoToken() > > + if not self._IsToken("[Rule.", True): > > FileLineTuple =3D GetRealFileLine(self.FileName, self.Curr= entLineNumber) > > #print 'Parsing String: %s in File %s, At line: %d, Offset= Within Line: %d' \ > > - # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > + # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > raise Warning("expected [Rule.]", self.FileName, self.Curr= entLineNumber) > > > > - if not self.__SkipToToken("."): > > + if not self._SkipToToken(TAB_SPLIT): > > raise Warning("expected '.'", self.FileName, self.CurrentL= ineNumber) > > > > - Arch =3D self.__SkippedChars.rstrip(".") > > + Arch =3D self._SkippedChars.rstrip(TAB_SPLIT) > > if Arch.upper() not in ARCH_SET_FULL: > > raise Warning("Unknown Arch '%s'" % Arch, self.FileName, s= elf.CurrentLineNumber) > > > > - ModuleType =3D self.__GetModuleType() > > + ModuleType =3D self._GetModuleType() > > > > TemplateName =3D "" > > - if self.__IsToken("."): > > - if not self.__GetNextWord(): > > + if self._IsToken(TAB_SPLIT): > > + if not self._GetNextWord(): > > raise Warning("expected template name", self.FileName,= self.CurrentLineNumber) > > - TemplateName =3D self.__Token > > + TemplateName =3D self._Token > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - RuleObj =3D self.__GetRuleFileStatements() > > + RuleObj =3D self._GetRuleFileStatements() > > RuleObj.Arch =3D Arch.upper() > > RuleObj.ModuleType =3D ModuleType > > RuleObj.TemplateName =3D TemplateName > > - if TemplateName =3D=3D '' : > > + if TemplateName =3D=3D '': > > self.Profile.RuleDict['RULE' + \ > > - '.' + \ > > + TAB_SPLIT + \ > > Arch.upper() + \ > > - '.' + \ > > + TAB_SPLIT + \ > > ModuleType.upper() ] =3D RuleObj > > - else : > > + else: > > self.Profile.RuleDict['RULE' + \ > > - '.' + \ > > + TAB_SPLIT + \ > > Arch.upper() + \ > > - '.' + \ > > + TAB_SPLIT + \ > > ModuleType.upper() + \ > > - '.' + \ > > + TAB_SPLIT + \ > > TemplateName.upper() ] =3D RuleObj > > return True > > > > - ## __GetModuleType() method > > + ## _GetModuleType() method > > # > > # Return the module type > > # > > # @param self The object pointer > > # @retval string module type > > # > > - def __GetModuleType(self): > > - > > - if not self.__GetNextWord(): > > + def _GetModuleType(self): > > + if not self._GetNextWord(): > > raise Warning("expected Module type", self.FileName, self.= CurrentLineNumber) > > - if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI= _CORE, SUP_MODULE_PEIM, > SUP_MODULE_DXE_CORE, \ > > + if self._Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_= CORE, SUP_MODULE_PEIM, > SUP_MODULE_DXE_CORE, \ > > SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL= _DRIVER, \ > > SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE= _RUNTIME_DRIVER, \ > > - SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_A= PPLICATION, SUP_MODULE_USER_DEFINED, > "DEFAULT", SUP_MODULE_BASE, \ > > + SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_A= PPLICATION, SUP_MODULE_USER_DEFINED, > TAB_DEFAULT, SUP_MODULE_BASE, \ > > EDK_COMPONENT_TYPE_SECURITY_CORE, > EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, > EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, \ > > "PE32_PEIM", EDK_COMPONENT_TYP= E_BS_DRIVER, > EDK_COMPONENT_TYPE_RT_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER, EDK_COMPO= NENT_TYPE_APPLICATION, "ACPITABLE", > SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDAL= ONE): > > - raise Warning("Unknown Module type '%s'" % self.__Token, s= elf.FileName, self.CurrentLineNumber) > > - return self.__Token > > + raise Warning("Unknown Module type '%s'" % self._Token, se= lf.FileName, self.CurrentLineNumber) > > + return self._Token > > > > - ## __GetFileExtension() method > > + ## _GetFileExtension() method > > # > > # Return the file extension > > # > > # @param self The object pointer > > # @retval string file name extension > > # > > - def __GetFileExtension(self): > > - if not self.__IsToken("."): > > + def _GetFileExtension(self): > > + if not self._IsToken(TAB_SPLIT): > > raise Warning("expected '.'", self.FileName, self.CurrentL= ineNumber) > > > > Ext =3D "" > > - if self.__GetNextToken(): > > - if FileExtensionPattern.match(self.__Token): > > - Ext =3D self.__Token > > - return '.' + Ext > > + if self._GetNextToken(): > > + if FileExtensionPattern.match(self._Token): > > + Ext =3D self._Token > > + return TAB_SPLIT + Ext > > else: > > - raise Warning("Unknown file extension '%s'" % self.__T= oken, self.FileName, self.CurrentLineNumber) > > + raise Warning("Unknown file extension '%s'" % self._To= ken, self.FileName, self.CurrentLineNumber) > > > > else: > > raise Warning("expected file extension", self.FileName, se= lf.CurrentLineNumber) > > > > - ## __GetRuleFileStatement() method > > + ## _GetRuleFileStatement() method > > # > > # Get rule contents > > # > > # @param self The object pointer > > # @retval Rule Rule object > > # > > - def __GetRuleFileStatements(self): > > - > > - if not self.__IsKeyword("FILE"): > > + def _GetRuleFileStatements(self): > > + if not self._IsKeyword("FILE"): > > raise Warning("expected FILE", self.FileName, self.Current= LineNumber) > > > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > raise Warning("expected FFS type", self.FileName, self.Cur= rentLineNumber) > > > > - Type =3D self.__Token.strip().upper() > > + Type =3D self._Token.strip().upper() > > if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_= PEI_CORE, SUP_MODULE_PEIM,\ > > "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE= _CORE, > EDK_COMPONENT_TYPE_APPLICATION, "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, S= UP_MODULE_MM_STANDALONE, > SUP_MODULE_MM_CORE_STANDALONE): > > - raise Warning("Unknown FV type '%s'" % self.__Token, self.= FileName, self.CurrentLineNumber) > > + raise Warning("Unknown FV type '%s'" % self._Token, self.F= ileName, self.CurrentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__IsKeyword("$(NAMED_GUID)"): > > - if not self.__GetNextWord(): > > + if not self._IsKeyword("$(NAMED_GUID)"): > > + if not self._GetNextWord(): > > raise Warning("expected $(NAMED_GUID)", self.FileName,= self.CurrentLineNumber) > > - if self.__Token =3D=3D 'PCD': > > - if not self.__IsToken( "("): > > + if self._Token =3D=3D 'PCD': > > + if not self._IsToken("("): > > raise Warning("expected '('", self.FileName, self.= CurrentLineNumber) > > - PcdPair =3D self.__GetNextPcdSettings() > > - if not self.__IsToken( ")"): > > + PcdPair =3D self._GetNextPcdSettings() > > + if not self._IsToken(")"): > > raise Warning("expected ')'", self.FileName, self.= CurrentLineNumber) > > - self.__Token =3D 'PCD('+PcdPair[1]+'.'+PcdPair[0]+')' > > + self._Token =3D 'PCD('+PcdPair[1]+TAB_SPLIT+PcdPair[0]= +')' > > > > - NameGuid =3D self.__Token > > + NameGuid =3D self._Token > > > > KeepReloc =3D None > > - if self.__IsKeyword('RELOCS_STRIPPED') or self.__IsKeyword('RE= LOCS_RETAINED'): > > - if self.__FileCouldHaveRelocFlag(Type): > > - if self.__Token =3D=3D 'RELOCS_STRIPPED': > > + if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RELO= CS_RETAINED'): > > + if self._FileCouldHaveRelocFlag(Type): > > + if self._Token =3D=3D 'RELOCS_STRIPPED': > > KeepReloc =3D False > > else: > > KeepReloc =3D True > > @@ -3729,111 +3645,109 @@ class FdfParser: > > raise Warning("File type %s could not have reloc strip= flag%d" % (Type, self.CurrentLineNumber), self.FileName, > self.CurrentLineNumber) > > > > KeyStringList =3D [] > > - if self.__GetNextToken(): > > - if TokenFindPattern.match(self.__Token): > > - KeyStringList.append(self.__Token) > > - if self.__IsToken(","): > > - while self.__GetNextToken(): > > - if not TokenFindPattern.match(self.__Token): > > + if self._GetNextToken(): > > + if TokenFindPattern.match(self._Token): > > + KeyStringList.append(self._Token) > > + if self._IsToken(TAB_COMMA_SPLIT): > > + while self._GetNextToken(): > > + if not TokenFindPattern.match(self._Token): > > raise Warning("expected KeyString \"Target= _Tag_Arch\"", self.FileName, self.CurrentLineNumber) > > - KeyStringList.append(self.__Token) > > + KeyStringList.append(self._Token) > > > > - if not self.__IsToken(","): > > + if not self._IsToken(TAB_COMMA_SPLIT): > > break > > > > else: > > - self.__UndoToken() > > + self._UndoToken() > > > > > > Fixed =3D False > > - if self.__IsKeyword("Fixed", True): > > + if self._IsKeyword("Fixed", True): > > Fixed =3D True > > > > CheckSum =3D False > > - if self.__IsKeyword("CheckSum", True): > > + if self._IsKeyword("CheckSum", True): > > CheckSum =3D True > > > > AlignValue =3D "" > > - if self.__GetAlignment(): > > - if self.__Token not in ("Auto", "8", "16", "32", "64", "12= 8", "512", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M", "4M", = "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % self.__Toke= n, self.FileName, self.CurrentLineNumber) > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENTS: > > + raise Warning("Incorrect alignment '%s'" % self._Token= , self.FileName, self.CurrentLineNumber) > > #For FFS, Auto is default option same to "" > > - if not self.__Token =3D=3D "Auto": > > - AlignValue =3D self.__Token > > + if not self._Token =3D=3D "Auto": > > + AlignValue =3D self._Token > > > > - if self.__IsToken("{"): > > + if self._IsToken("{"): > > # Complex file rule expected > > - Rule =3D RuleComplexFile.RuleComplexFile() > > - Rule.FvFileType =3D Type > > - Rule.NameGuid =3D NameGuid > > - Rule.Alignment =3D AlignValue > > - Rule.CheckSum =3D CheckSum > > - Rule.Fixed =3D Fixed > > - Rule.KeyStringList =3D KeyStringList > > + NewRule =3D RuleComplexFile() > > + NewRule.FvFileType =3D Type > > + NewRule.NameGuid =3D NameGuid > > + NewRule.Alignment =3D AlignValue > > + NewRule.CheckSum =3D CheckSum > > + NewRule.Fixed =3D Fixed > > + NewRule.KeyStringList =3D KeyStringList > > if KeepReloc is not None: > > - Rule.KeepReloc =3D KeepReloc > > + NewRule.KeepReloc =3D KeepReloc > > > > while True: > > - IsEncapsulate =3D self.__GetRuleEncapsulationSection(R= ule) > > - IsLeaf =3D self.__GetEfiSection(Rule) > > + IsEncapsulate =3D self._GetRuleEncapsulationSection(Ne= wRule) > > + IsLeaf =3D self._GetEfiSection(NewRule) > > if not IsEncapsulate and not IsLeaf: > > break > > > > - if not self.__IsToken("}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > > > - return Rule > > + return NewRule > > > > else: > > # Simple file rule expected > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > raise Warning("expected leaf section type", self.FileN= ame, self.CurrentLineNumber) > > > > - SectionName =3D self.__Token > > + SectionName =3D self._Token > > > > if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, = BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > BINARY_FILE_TYPE_UI, BINARY_FILE_T= YPE_PEI_DEPEX, "VERSION", "SUBTYPE_GUID", > BINARY_FILE_TYPE_SMM_DEPEX): > > raise Warning("Unknown leaf section name '%s'" % Secti= onName, self.FileName, self.CurrentLineNumber) > > > > > > - if self.__IsKeyword("Fixed", True): > > + if self._IsKeyword("Fixed", True): > > Fixed =3D True > > > > - if self.__IsKeyword("CheckSum", True): > > + if self._IsKeyword("CheckSum", True): > > CheckSum =3D True > > > > SectAlignment =3D "" > > - if self.__GetAlignment(): > > - if self.__Token not in ("Auto", "8", "16", "32", "64",= "128", "512", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M", "4= M", "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % self.__= Token, self.FileName, self.CurrentLineNumber) > > - if self.__Token =3D=3D 'Auto' and (not SectionName =3D= =3D BINARY_FILE_TYPE_PE32) and (not SectionName =3D=3D > BINARY_FILE_TYPE_TE): > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENTS: > > + raise Warning("Incorrect alignment '%s'" % self._T= oken, self.FileName, self.CurrentLineNumber) > > + if self._Token =3D=3D 'Auto' and (not SectionName =3D= =3D BINARY_FILE_TYPE_PE32) and (not SectionName =3D=3D > BINARY_FILE_TYPE_TE): > > raise Warning("Auto alignment can only be used in = PE32 or TE section ", self.FileName, > self.CurrentLineNumber) > > - SectAlignment =3D self.__Token > > + SectAlignment =3D self._Token > > > > Ext =3D None > > - if self.__IsToken('|'): > > - Ext =3D self.__GetFileExtension() > > - elif not self.__GetNextToken(): > > + if self._IsToken(TAB_VALUE_SPLIT): > > + Ext =3D self._GetFileExtension() > > + elif not self._GetNextToken(): > > raise Warning("expected File name", self.FileName, sel= f.CurrentLineNumber) > > > > - Rule =3D RuleSimpleFile.RuleSimpleFile() > > - Rule.SectionType =3D SectionName > > - Rule.FvFileType =3D Type > > - Rule.NameGuid =3D NameGuid > > - Rule.Alignment =3D AlignValue > > - Rule.SectAlignment =3D SectAlignment > > - Rule.CheckSum =3D CheckSum > > - Rule.Fixed =3D Fixed > > - Rule.KeyStringList =3D KeyStringList > > + NewRule =3D RuleSimpleFile() > > + NewRule.SectionType =3D SectionName > > + NewRule.FvFileType =3D Type > > + NewRule.NameGuid =3D NameGuid > > + NewRule.Alignment =3D AlignValue > > + NewRule.SectAlignment =3D SectAlignment > > + NewRule.CheckSum =3D CheckSum > > + NewRule.Fixed =3D Fixed > > + NewRule.KeyStringList =3D KeyStringList > > if KeepReloc is not None: > > - Rule.KeepReloc =3D KeepReloc > > - Rule.FileExtension =3D Ext > > - Rule.FileName =3D self.__Token > > - return Rule > > + NewRule.KeepReloc =3D KeepReloc > > + NewRule.FileExtension =3D Ext > > + NewRule.FileName =3D self._Token > > + return NewRule > > > > - ## __GetEfiSection() method > > + ## _GetEfiSection() method > > # > > # Get section list for Rule > > # > > @@ -3842,127 +3756,124 @@ class FdfParser: > > # @retval True Successfully find section statement > > # @retval False Not able to find section statement > > # > > - def __GetEfiSection(self, Obj): > > - > > + def _GetEfiSection(self, Obj): > > OldPos =3D self.GetFileBufferPos() > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > return False > > - SectionName =3D self.__Token > > + SectionName =3D self._Token > > > > if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINA= RY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > BINARY_FILE_TYPE_UI, "VERSION", BINARY_= FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, > BINARY_FILE_TYPE_SMM_DEPEX): > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > if SectionName =3D=3D "FV_IMAGE": > > - FvImageSectionObj =3D FvImageSection.FvImageSection() > > - if self.__IsKeyword("FV_IMAGE"): > > + FvImageSectionObj =3D FvImageSection() > > + if self._IsKeyword("FV_IMAGE"): > > pass > > - if self.__IsToken( "{"): > > - FvObj =3D Fv.FV() > > - self.__GetDefineStatements(FvObj) > > - self.__GetBlockStatement(FvObj) > > - self.__GetSetStatements(FvObj) > > - self.__GetFvAlignment(FvObj) > > - self.__GetFvAttributes(FvObj) > > - self.__GetAprioriSection(FvObj) > > - self.__GetAprioriSection(FvObj) > > + if self._IsToken("{"): > > + FvObj =3D FV() > > + self._GetDefineStatements(FvObj) > > + self._GetBlockStatement(FvObj) > > + self._GetSetStatements(FvObj) > > + self._GetFvAlignment(FvObj) > > + self._GetFvAttributes(FvObj) > > + self._GetAprioriSection(FvObj) > > + self._GetAprioriSection(FvObj) > > > > while True: > > - IsInf =3D self.__GetInfStatement(FvObj) > > - IsFile =3D self.__GetFileStatement(FvObj) > > + IsInf =3D self._GetInfStatement(FvObj) > > + IsFile =3D self._GetFileStatement(FvObj) > > if not IsInf and not IsFile: > > break > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.= CurrentLineNumber) > > FvImageSectionObj.Fv =3D FvObj > > FvImageSectionObj.FvName =3D None > > > > else: > > - if not self.__IsKeyword(BINARY_FILE_TYPE_FV): > > - raise Warning("expected BINARY_FILE_TYPE_FV", self= .FileName, self.CurrentLineNumber) > > - FvImageSectionObj.FvFileType =3D self.__Token > > + if not self._IsKeyword(BINARY_FILE_TYPE_FV): > > + raise Warning("expected 'FV'", self.FileName, self= .CurrentLineNumber) > > + FvImageSectionObj.FvFileType =3D self._Token > > > > - if self.__GetAlignment(): > > - if self.__Token not in ("8", "16", "32", "64", "12= 8", "512", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M"= , "4M", "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % sel= f.__Token, self.FileName, self.CurrentLineNumber) > > - FvImageSectionObj.Alignment =3D self.__Token > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENT_NOAUTO: > > + raise Warning("Incorrect alignment '%s'" % sel= f._Token, self.FileName, self.CurrentLineNumber) > > + FvImageSectionObj.Alignment =3D self._Token > > > > - if self.__IsToken('|'): > > - FvImageSectionObj.FvFileExtension =3D self.__GetFi= leExtension() > > - elif self.__GetNextToken(): > > - if self.__Token not in ("}", "COMPAT16", BINARY_FI= LE_TYPE_PE32, BINARY_FILE_TYPE_PIC, > BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > + if self._IsToken(TAB_VALUE_SPLIT): > > + FvImageSectionObj.FvFileExtension =3D self._GetFil= eExtension() > > + elif self._GetNextToken(): > > + if self._Token not in ("}", "COMPAT16", BINARY_FIL= E_TYPE_PE32, BINARY_FILE_TYPE_PIC, > BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > BINARY_FILE_TYPE_UI, "VERSION", BINARY_= FILE_TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, > BINARY_FILE_TYPE_SMM_DEPEX): > > - FvImageSectionObj.FvFileName =3D self.__Token > > + FvImageSectionObj.FvFileName =3D self._Token > > else: > > - self.__UndoToken() > > + self._UndoToken() > > else: > > raise Warning("expected FV file name", self.FileNa= me, self.CurrentLineNumber) > > > > Obj.SectionList.append(FvImageSectionObj) > > return True > > > > - EfiSectionObj =3D EfiSection.EfiSection() > > + EfiSectionObj =3D EfiSection() > > EfiSectionObj.SectionType =3D SectionName > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected file type", self.FileName, self.Cu= rrentLineNumber) > > > > - if self.__Token =3D=3D "STRING": > > - if not self.__RuleSectionCouldHaveString(EfiSectionObj.Sec= tionType): > > + if self._Token =3D=3D "STRING": > > + if not self._RuleSectionCouldHaveString(EfiSectionObj.Sect= ionType): > > raise Warning("%s section could NOT have string data%d= " % (EfiSectionObj.SectionType, self.CurrentLineNumber), > self.FileName, self.CurrentLineNumber) > > > > - if not self.__IsToken('=3D'): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Quoted String", self.FileName,= self.CurrentLineNumber) > > > > - if self.__GetStringData(): > > - EfiSectionObj.StringData =3D self.__Token > > + if self._GetStringData(): > > + EfiSectionObj.StringData =3D self._Token > > > > - if self.__IsKeyword("BUILD_NUM"): > > - if not self.__RuleSectionCouldHaveBuildNum(EfiSectionO= bj.SectionType): > > + if self._IsKeyword("BUILD_NUM"): > > + if not self._RuleSectionCouldHaveBuildNum(EfiSectionOb= j.SectionType): > > raise Warning("%s section could NOT have BUILD_NUM= %d" % (EfiSectionObj.SectionType, > self.CurrentLineNumber), self.FileName, self.CurrentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, sel= f.CurrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Build number", self.FileNa= me, self.CurrentLineNumber) > > - EfiSectionObj.BuildNum =3D self.__Token > > + EfiSectionObj.BuildNum =3D self._Token > > > > else: > > - EfiSectionObj.FileType =3D self.__Token > > - self.__CheckRuleSectionFileType(EfiSectionObj.SectionType,= EfiSectionObj.FileType) > > + EfiSectionObj.FileType =3D self._Token > > + self._CheckRuleSectionFileType(EfiSectionObj.SectionType, = EfiSectionObj.FileType) > > > > - if self.__IsKeyword("Optional"): > > - if not self.__RuleSectionCouldBeOptional(EfiSectionObj.Sec= tionType): > > + if self._IsKeyword("Optional"): > > + if not self._RuleSectionCouldBeOptional(EfiSectionObj.Sect= ionType): > > raise Warning("%s section could NOT be optional%d" % (= EfiSectionObj.SectionType, self.CurrentLineNumber), > self.FileName, self.CurrentLineNumber) > > EfiSectionObj.Optional =3D True > > > > - if self.__IsKeyword("BUILD_NUM"): > > - if not self.__RuleSectionCouldHaveBuildNum(EfiSectionO= bj.SectionType): > > + if self._IsKeyword("BUILD_NUM"): > > + if not self._RuleSectionCouldHaveBuildNum(EfiSectionOb= j.SectionType): > > raise Warning("%s section could NOT have BUILD_NUM= %d" % (EfiSectionObj.SectionType, > self.CurrentLineNumber), self.FileName, self.CurrentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, sel= f.CurrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Build number", self.FileNa= me, self.CurrentLineNumber) > > - EfiSectionObj.BuildNum =3D self.__Token > > + EfiSectionObj.BuildNum =3D self._Token > > > > - if self.__GetAlignment(): > > - if self.__Token not in ("Auto", "8", "16", "32", "64", "12= 8", "512", "1K", "4K", "32K", "64K", "128K", > > - "256K", "512K", "1M", "2M", "4M", = "8M", "16M"): > > - raise Warning("Incorrect alignment '%s'" % self.__Toke= n, self.FileName, self.CurrentLineNumber) > > - if self.__Token =3D=3D 'Auto' and (not SectionName =3D=3D = BINARY_FILE_TYPE_PE32) and (not SectionName =3D=3D > BINARY_FILE_TYPE_TE): > > + if self._GetAlignment(): > > + if self._Token not in ALIGNMENTS: > > + raise Warning("Incorrect alignment '%s'" % self._Token= , self.FileName, self.CurrentLineNumber) > > + if self._Token =3D=3D 'Auto' and (not SectionName =3D=3D B= INARY_FILE_TYPE_PE32) and (not SectionName =3D=3D > BINARY_FILE_TYPE_TE): > > raise Warning("Auto alignment can only be used in PE32= or TE section ", self.FileName, self.CurrentLineNumber) > > - EfiSectionObj.Alignment =3D self.__Token > > + EfiSectionObj.Alignment =3D self._Token > > > > - if self.__IsKeyword('RELOCS_STRIPPED') or self.__IsKeyword('RE= LOCS_RETAINED'): > > - if self.__SectionCouldHaveRelocFlag(EfiSectionObj.SectionT= ype): > > - if self.__Token =3D=3D 'RELOCS_STRIPPED': > > + if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RELO= CS_RETAINED'): > > + if self._SectionCouldHaveRelocFlag(EfiSectionObj.SectionTy= pe): > > + if self._Token =3D=3D 'RELOCS_STRIPPED': > > EfiSectionObj.KeepReloc =3D False > > else: > > EfiSectionObj.KeepReloc =3D True > > @@ -3972,35 +3883,35 @@ class FdfParser: > > raise Warning("Section type %s could not have reloc st= rip flag" % EfiSectionObj.SectionType, self.FileName, > self.CurrentLineNumber) > > > > > > - if self.__IsToken('|'): > > - EfiSectionObj.FileExtension =3D self.__GetFileExtension() > > - elif self.__GetNextToken(): > > - if self.__Token not in ("}", "COMPAT16", BINARY_FILE_TYPE_= PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > + if self._IsToken(TAB_VALUE_SPLIT): > > + EfiSectionObj.FileExtension =3D self._GetFileExtension() > > + elif self._GetNextToken(): > > + if self._Token not in ("}", "COMPAT16", BINARY_FILE_TYPE_P= E32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYP= E_PEI_DEPEX, BINARY_FILE_TYPE_GUID, > BINARY_FILE_TYPE_SMM_DEPEX): > > > > - if self.__Token.startswith('PCD'): > > - self.__UndoToken() > > - self.__GetNextWord() > > + if self._Token.startswith('PCD'): > > + self._UndoToken() > > + self._GetNextWord() > > > > - if self.__Token =3D=3D 'PCD': > > - if not self.__IsToken( "("): > > + if self._Token =3D=3D 'PCD': > > + if not self._IsToken("("): > > raise Warning("expected '('", self.FileNam= e, self.CurrentLineNumber) > > - PcdPair =3D self.__GetNextPcdSettings() > > - if not self.__IsToken( ")"): > > + PcdPair =3D self._GetNextPcdSettings() > > + if not self._IsToken(")"): > > raise Warning("expected ')'", self.FileNam= e, self.CurrentLineNumber) > > - self.__Token =3D 'PCD('+PcdPair[1]+'.'+PcdPair= [0]+')' > > + self._Token =3D 'PCD('+PcdPair[1]+TAB_SPLIT+Pc= dPair[0]+')' > > > > - EfiSectionObj.FileName =3D self.__Token > > + EfiSectionObj.FileName =3D self._Token > > > > else: > > - self.__UndoToken() > > + self._UndoToken() > > else: > > raise Warning("expected section file name", self.FileName,= self.CurrentLineNumber) > > > > Obj.SectionList.append(EfiSectionObj) > > return True > > > > - ## __RuleSectionCouldBeOptional() method > > + ## _RuleSectionCouldBeOptional() method > > # > > # Get whether a section could be optional > > # > > @@ -4009,13 +3920,13 @@ class FdfParser: > > # @retval False section never optional > > # > > @staticmethod > > - def __RuleSectionCouldBeOptional(SectionType): > > + def _RuleSectionCouldBeOptional(SectionType): > > if SectionType in (BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYP= E_UI, "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, > "RAW", BINARY_FILE_TYPE_SMM_DEPEX): > > return True > > else: > > return False > > > > - ## __RuleSectionCouldHaveBuildNum() method > > + ## _RuleSectionCouldHaveBuildNum() method > > # > > # Get whether a section could have build number information > > # > > @@ -4024,13 +3935,13 @@ class FdfParser: > > # @retval False section never have build number informatio= n > > # > > @staticmethod > > - def __RuleSectionCouldHaveBuildNum(SectionType): > > + def _RuleSectionCouldHaveBuildNum(SectionType): > > if SectionType in ("VERSION"): > > return True > > else: > > return False > > > > - ## __RuleSectionCouldHaveString() method > > + ## _RuleSectionCouldHaveString() method > > # > > # Get whether a section could have string > > # > > @@ -4039,13 +3950,13 @@ class FdfParser: > > # @retval False section never have string > > # > > @staticmethod > > - def __RuleSectionCouldHaveString(SectionType): > > + def _RuleSectionCouldHaveString(SectionType): > > if SectionType in (BINARY_FILE_TYPE_UI, "VERSION"): > > return True > > else: > > return False > > > > - ## __CheckRuleSectionFileType() method > > + ## _CheckRuleSectionFileType() method > > # > > # Get whether a section matches a file type > > # > > @@ -4053,7 +3964,7 @@ class FdfParser: > > # @param SectionType The section type to check > > # @param FileType The file type to check > > # > > - def __CheckRuleSectionFileType(self, SectionType, FileType): > > + def _CheckRuleSectionFileType(self, SectionType, FileType): > > if SectionType =3D=3D "COMPAT16": > > if FileType not in ("COMPAT16", "SEC_COMPAT16"): > > raise Warning("Incorrect section file type '%s'" % Fil= eType, self.FileName, self.CurrentLineNumber) > > @@ -4085,53 +3996,53 @@ class FdfParser: > > if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_GUID"): > > raise Warning("Incorrect section file type '%s'" % Fil= eType, self.FileName, self.CurrentLineNumber) > > > > - ## __GetRuleEncapsulationSection() method > > + ## _GetRuleEncapsulationSection() method > > # > > # Get encapsulation section for Rule > > # > > # @param self The object pointer > > - # @param Rule for whom section is got > > + # @param theRule for whom section is got > > # @retval True Successfully find section statement > > # @retval False Not able to find section statement > > # > > - def __GetRuleEncapsulationSection(self, Rule): > > - if self.__IsKeyword( "COMPRESS"): > > + def _GetRuleEncapsulationSection(self, theRule): > > + if self._IsKeyword("COMPRESS"): > > Type =3D "PI_STD" > > - if self.__IsKeyword("PI_STD") or self.__IsKeyword("PI_NONE= "): > > - Type =3D self.__Token > > + if self._IsKeyword("PI_STD") or self._IsKeyword("PI_NONE")= : > > + Type =3D self._Token > > > > - if not self.__IsToken("{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > > > - CompressSectionObj =3D CompressSection.CompressSection() > > + CompressSectionObj =3D CompressSection() > > > > CompressSectionObj.CompType =3D Type > > # Recursive sections... > > while True: > > - IsEncapsulate =3D self.__GetRuleEncapsulationSection(C= ompressSectionObj) > > - IsLeaf =3D self.__GetEfiSection(CompressSectionObj) > > + IsEncapsulate =3D self._GetRuleEncapsulationSection(Co= mpressSectionObj) > > + IsLeaf =3D self._GetEfiSection(CompressSectionObj) > > if not IsEncapsulate and not IsLeaf: > > break > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > - Rule.SectionList.append(CompressSectionObj) > > + theRule.SectionList.append(CompressSectionObj) > > > > return True > > > > - elif self.__IsKeyword( "GUIDED"): > > + elif self._IsKeyword("GUIDED"): > > GuidValue =3D None > > - if self.__GetNextGuid(): > > - GuidValue =3D self.__Token > > + if self._GetNextGuid(): > > + GuidValue =3D self._Token > > > > - if self.__IsKeyword( "$(NAMED_GUID)"): > > - GuidValue =3D self.__Token > > + if self._IsKeyword("$(NAMED_GUID)"): > > + GuidValue =3D self._Token > > > > - AttribDict =3D self.__GetGuidAttrib() > > + AttribDict =3D self._GetGuidAttrib() > > > > - if not self.__IsToken("{"): > > + if not self._IsToken("{"): > > raise Warning("expected '{'", self.FileName, self.Curr= entLineNumber) > > - GuidSectionObj =3D GuidSection.GuidSection() > > + GuidSectionObj =3D GuidSection() > > GuidSectionObj.NameGuid =3D GuidValue > > GuidSectionObj.SectionType =3D "GUIDED" > > GuidSectionObj.ProcessRequired =3D AttribDict["PROCESSING_= REQUIRED"] > > @@ -4140,20 +4051,20 @@ class FdfParser: > > > > # Efi sections... > > while True: > > - IsEncapsulate =3D self.__GetRuleEncapsulationSection(G= uidSectionObj) > > - IsLeaf =3D self.__GetEfiSection(GuidSectionObj) > > + IsEncapsulate =3D self._GetRuleEncapsulationSection(Gu= idSectionObj) > > + IsLeaf =3D self._GetEfiSection(GuidSectionObj) > > if not IsEncapsulate and not IsLeaf: > > break > > > > - if not self.__IsToken( "}"): > > + if not self._IsToken("}"): > > raise Warning("expected '}'", self.FileName, self.Curr= entLineNumber) > > - Rule.SectionList.append(GuidSectionObj) > > + theRule.SectionList.append(GuidSectionObj) > > > > return True > > > > return False > > > > - ## __GetVtf() method > > + ## _GetVtf() method > > # > > # Get VTF section contents and store its data into VTF list of s= elf.Profile > > # > > @@ -4161,69 +4072,69 @@ class FdfParser: > > # @retval True Successfully find a VTF > > # @retval False Not able to find a VTF > > # > > - def __GetVtf(self): > > - if not self.__GetNextToken(): > > + def _GetVtf(self): > > + if not self._GetNextToken(): > > return False > > > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[VTF."): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[VTF.= "): > > self.SectionParser(S) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - self.__UndoToken() > > - if not self.__IsToken("[VTF.", True): > > + self._UndoToken() > > + if not self._IsToken("[VTF.", True): > > FileLineTuple =3D GetRealFileLine(self.FileName, self.Curr= entLineNumber) > > #print 'Parsing String: %s in File %s, At line: %d, Offset= Within Line: %d' \ > > - # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > + # % (self.Profile.FileLinesList[self.CurrentLineNum= ber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > FileLineTuple[1], self.CurrentOffsetWithinLine) > > raise Warning("expected [VTF.]", self.FileName, self.Curre= ntLineNumber) > > > > - if not self.__SkipToToken("."): > > + if not self._SkipToToken(TAB_SPLIT): > > raise Warning("expected '.'", self.FileName, self.CurrentL= ineNumber) > > > > - Arch =3D self.__SkippedChars.rstrip(".").upper() > > - if Arch not in ("IA32", "X64", "IPF", "ARM", "AARCH64"): > > + Arch =3D self._SkippedChars.rstrip(TAB_SPLIT).upper() > > + if Arch not in {TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB= _ARCH_ARM, TAB_ARCH_AARCH64}: > > raise Warning("Unknown Arch '%s'" % Arch, self.FileName, s= elf.CurrentLineNumber) > > > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > raise Warning("expected VTF name", self.FileName, self.Cur= rentLineNumber) > > - Name =3D self.__Token.upper() > > + Name =3D self._Token.upper() > > > > - VtfObj =3D Vtf.Vtf() > > + VtfObj =3D Vtf() > > VtfObj.UiName =3D Name > > VtfObj.KeyArch =3D Arch > > > > - if self.__IsToken(","): > > - if not self.__GetNextWord(): > > + if self._IsToken(TAB_COMMA_SPLIT): > > + if not self._GetNextWord(): > > raise Warning("expected Arch list", self.FileName, sel= f.CurrentLineNumber) > > - if self.__Token.upper() not in ("IA32", "X64", "IPF", "ARM= ", "AARCH64"): > > - raise Warning("Unknown Arch '%s'" % self.__Token, self= .FileName, self.CurrentLineNumber) > > - VtfObj.ArchList =3D self.__Token.upper() > > + if self._Token.upper() not in (TAB_ARCH_IA32, TAB_ARCH_X64= , TAB_ARCH_IPF, TAB_ARCH_ARM, > TAB_ARCH_AARCH64): > > + raise Warning("Unknown Arch '%s'" % self._Token, self.= FileName, self.CurrentLineNumber) > > + VtfObj.ArchList =3D self._Token.upper() > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - if self.__IsKeyword("IA32_RST_BIN"): > > - if not self.__IsToken("=3D"): > > + if self._IsKeyword("IA32_RST_BIN"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Reset file", self.FileName, se= lf.CurrentLineNumber) > > > > - VtfObj.ResetBin =3D self.__Token > > - if VtfObj.ResetBin.replace('$(WORKSPACE)', '').find('$') = =3D=3D -1: > > + VtfObj.ResetBin =3D self._Token > > + if VtfObj.ResetBin.replace(TAB_WORKSPACE, '').find('$') = =3D=3D -1: > > #check for file path > > ErrorCode, ErrorInfo =3D PathClass(NormPath(VtfObj.Res= etBin), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > if ErrorCode !=3D 0: > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DE= rrorInfo) > > > > - while self.__GetComponentStatement(VtfObj): > > + while self._GetComponentStatement(VtfObj): > > pass > > > > self.Profile.VtfList.append(VtfObj) > > return True > > > > - ## __GetComponentStatement() method > > + ## _GetComponentStatement() method > > # > > # Get components in VTF > > # > > @@ -4232,132 +4143,132 @@ class FdfParser: > > # @retval True Successfully find a component > > # @retval False Not able to find a component > > # > > - def __GetComponentStatement(self, VtfObj): > > - if not self.__IsKeyword("COMP_NAME"): > > + def _GetComponentStatement(self, VtfObj): > > + if not self._IsKeyword("COMP_NAME"): > > return False > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextWord(): > > + if not self._GetNextWord(): > > raise Warning("expected Component Name", self.FileName, se= lf.CurrentLineNumber) > > > > - CompStatementObj =3D ComponentStatement.ComponentStatement() > > - CompStatementObj.CompName =3D self.__Token > > + CompStatementObj =3D ComponentStatement() > > + CompStatementObj.CompName =3D self._Token > > > > - if not self.__IsKeyword("COMP_LOC"): > > + if not self._IsKeyword("COMP_LOC"): > > raise Warning("expected COMP_LOC", self.FileName, self.Cur= rentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > CompStatementObj.CompLoc =3D "" > > - if self.__GetNextWord(): > > - CompStatementObj.CompLoc =3D self.__Token > > - if self.__IsToken('|'): > > - if not self.__GetNextWord(): > > + if self._GetNextWord(): > > + CompStatementObj.CompLoc =3D self._Token > > + if self._IsToken(TAB_VALUE_SPLIT): > > + if not self._GetNextWord(): > > raise Warning("Expected Region Name", self.FileNam= e, self.CurrentLineNumber) > > > > - if self.__Token not in ("F", "N", "S"): #, "H", "L"= , "PH", "PL"): not support > > - raise Warning("Unknown location type '%s'" % self.= __Token, self.FileName, self.CurrentLineNumber) > > + if self._Token not in ("F", "N", "S"): #, "H", "L",= "PH", "PL"): not support > > + raise Warning("Unknown location type '%s'" % self.= _Token, self.FileName, self.CurrentLineNumber) > > > > - CompStatementObj.FilePos =3D self.__Token > > + CompStatementObj.FilePos =3D self._Token > > else: > > self.CurrentLineNumber +=3D 1 > > self.CurrentOffsetWithinLine =3D 0 > > > > - if not self.__IsKeyword("COMP_TYPE"): > > + if not self._IsKeyword("COMP_TYPE"): > > raise Warning("expected COMP_TYPE", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Component type", self.FileName, se= lf.CurrentLineNumber) > > - if self.__Token not in ("FIT", "PAL_B", "PAL_A", "OEM"): > > - if not self.__Token.startswith("0x") or len(self.__Token) = < 3 or len(self.__Token) > 4 or \ > > - not self.__Token[2] in string.hexdigits or not self.__= Token[-1] in string.hexdigits: > > - raise Warning("Unknown location type '%s'" % self.__To= ken, self.FileName, self.CurrentLineNumber) > > - CompStatementObj.CompType =3D self.__Token > > + if self._Token not in ("FIT", "PAL_B", "PAL_A", "OEM"): > > + if not self._Token.startswith("0x") or len(self._Token) < = 3 or len(self._Token) > 4 or \ > > + not self._Token[2] in hexdigits or not self._Token[-1]= in hexdigits: > > + raise Warning("Unknown location type '%s'" % self._Tok= en, self.FileName, self.CurrentLineNumber) > > + CompStatementObj.CompType =3D self._Token > > > > - if not self.__IsKeyword("COMP_VER"): > > + if not self._IsKeyword("COMP_VER"): > > raise Warning("expected COMP_VER", self.FileName, self.Cur= rentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Component version", self.FileName,= self.CurrentLineNumber) > > > > - Pattern =3D re.compile('-$|[0-9a-fA-F]{1,2}\.[0-9a-fA-F]{1,2}$= ', re.DOTALL) > > - if Pattern.match(self.__Token) is None: > > - raise Warning("Unknown version format '%s'" % self.__Token= , self.FileName, self.CurrentLineNumber) > > - CompStatementObj.CompVer =3D self.__Token > > + Pattern =3D compile('-$|[0-9a-fA-F]{1,2}\.[0-9a-fA-F]{1,2}$', = DOTALL) > > + if Pattern.match(self._Token) is None: > > + raise Warning("Unknown version format '%s'" % self._Token,= self.FileName, self.CurrentLineNumber) > > + CompStatementObj.CompVer =3D self._Token > > > > - if not self.__IsKeyword("COMP_CS"): > > + if not self._IsKeyword("COMP_CS"): > > raise Warning("expected COMP_CS", self.FileName, self.Curr= entLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Component CS", self.FileName, self= .CurrentLineNumber) > > - if self.__Token not in ("1", "0"): > > - raise Warning("Unknown Component CS '%s'" % self.__Token,= self.FileName, self.CurrentLineNumber) > > - CompStatementObj.CompCs =3D self.__Token > > + if self._Token not in ("1", "0"): > > + raise Warning("Unknown Component CS '%s'" % self._Token, = self.FileName, self.CurrentLineNumber) > > + CompStatementObj.CompCs =3D self._Token > > > > > > - if not self.__IsKeyword("COMP_BIN"): > > + if not self._IsKeyword("COMP_BIN"): > > raise Warning("expected COMP_BIN", self.FileName, self.Cur= rentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Component file", self.FileName, se= lf.CurrentLineNumber) > > > > - CompStatementObj.CompBin =3D self.__Token > > - if CompStatementObj.CompBin !=3D '-' and CompStatementObj.Comp= Bin.replace('$(WORKSPACE)', '').find('$') =3D=3D -1: > > + CompStatementObj.CompBin =3D self._Token > > + if CompStatementObj.CompBin !=3D '-' and CompStatementObj.Comp= Bin.replace(TAB_WORKSPACE, '').find('$') =3D=3D -1: > > #check for file path > > ErrorCode, ErrorInfo =3D PathClass(NormPath(CompStatementO= bj.CompBin), > GenFdsGlobalVariable.WorkSpaceDir).Validate() > > if ErrorCode !=3D 0: > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DError= Info) > > > > - if not self.__IsKeyword("COMP_SYM"): > > + if not self._IsKeyword("COMP_SYM"): > > raise Warning("expected COMP_SYM", self.FileName, self.Cur= rentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected Component symbol file", self.FileN= ame, self.CurrentLineNumber) > > > > - CompStatementObj.CompSym =3D self.__Token > > - if CompStatementObj.CompSym !=3D '-' and CompStatementObj.Comp= Sym.replace('$(WORKSPACE)', '').find('$') =3D=3D -1: > > + CompStatementObj.CompSym =3D self._Token > > + if CompStatementObj.CompSym !=3D '-' and CompStatementObj.Comp= Sym.replace(TAB_WORKSPACE, '').find('$') =3D=3D -1: > > #check for file path > > ErrorCode, ErrorInfo =3D PathClass(NormPath(CompStatementO= bj.CompSym), > GenFdsGlobalVariable.WorkSpaceDir).Validate() > > if ErrorCode !=3D 0: > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DError= Info) > > > > - if not self.__IsKeyword("COMP_SIZE"): > > + if not self._IsKeyword("COMP_SIZE"): > > raise Warning("expected COMP_SIZE", self.FileName, self.Cu= rrentLineNumber) > > > > - if not self.__IsToken("=3D"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) > > > > - if self.__IsToken("-"): > > - CompStatementObj.CompSize =3D self.__Token > > - elif self.__GetNextDecimalNumber(): > > - CompStatementObj.CompSize =3D self.__Token > > - elif self.__GetNextHexNumber(): > > - CompStatementObj.CompSize =3D self.__Token > > + if self._IsToken("-"): > > + CompStatementObj.CompSize =3D self._Token > > + elif self._GetNextDecimalNumber(): > > + CompStatementObj.CompSize =3D self._Token > > + elif self._GetNextHexNumber(): > > + CompStatementObj.CompSize =3D self._Token > > else: > > - raise Warning("Unknown size '%s'" % self.__Token, self.Fil= eName, self.CurrentLineNumber) > > + raise Warning("Unknown size '%s'" % self._Token, self.File= Name, self.CurrentLineNumber) > > > > VtfObj.ComponentStatementList.append(CompStatementObj) > > return True > > > > - ## __GetOptionRom() method > > + ## _GetOptionRom() method > > # > > # Get OptionROM section contents and store its data into OptionR= OM list of self.Profile > > # > > @@ -4365,38 +4276,37 @@ class FdfParser: > > # @retval True Successfully find a OptionROM > > # @retval False Not able to find a OptionROM > > # > > - def __GetOptionRom(self): > > - if not self.__GetNextToken(): > > + def _GetOptionRom(self): > > + if not self._GetNextToken(): > > return False > > > > - S =3D self.__Token.upper() > > - if S.startswith("[") and not S.startswith("[OPTIONROM."): > > + S =3D self._Token.upper() > > + if S.startswith(TAB_SECTION_START) and not S.startswith("[OPTI= ONROM."): > > self.SectionParser(S) > > - self.__UndoToken() > > + self._UndoToken() > > return False > > > > - self.__UndoToken() > > - if not self.__IsToken("[OptionRom.", True): > > - raise Warning("Unknown Keyword '%s'" % self.__Token, self.= FileName, self.CurrentLineNumber) > > + self._UndoToken() > > + if not self._IsToken("[OptionRom.", True): > > + raise Warning("Unknown Keyword '%s'" % self._Token, self.F= ileName, self.CurrentLineNumber) > > > > - OptRomName =3D self.__GetUiName() > > + OptRomName =3D self._GetUiName() > > > > - if not self.__IsToken( "]"): > > + if not self._IsToken(TAB_SECTION_END): > > raise Warning("expected ']'", self.FileName, self.CurrentL= ineNumber) > > > > - OptRomObj =3D OptionRom.OPTIONROM() > > - OptRomObj.DriverName =3D OptRomName > > + OptRomObj =3D OPTIONROM(OptRomName) > > self.Profile.OptRomDict[OptRomName] =3D OptRomObj > > > > while True: > > - isInf =3D self.__GetOptRomInfStatement(OptRomObj) > > - isFile =3D self.__GetOptRomFileStatement(OptRomObj) > > + isInf =3D self._GetOptRomInfStatement(OptRomObj) > > + isFile =3D self._GetOptRomFileStatement(OptRomObj) > > if not isInf and not isFile: > > break > > > > return True > > > > - ## __GetOptRomInfStatement() method > > + ## _GetOptRomInfStatement() method > > # > > # Get INF statements > > # > > @@ -4405,17 +4315,17 @@ class FdfParser: > > # @retval True Successfully find inf statement > > # @retval False Not able to find inf statement > > # > > - def __GetOptRomInfStatement(self, Obj): > > - if not self.__IsKeyword( "INF"): > > + def _GetOptRomInfStatement(self, Obj): > > + if not self._IsKeyword("INF"): > > return False > > > > - ffsInf =3D OptRomInfStatement.OptRomInfStatement() > > - self.__GetInfOptions( ffsInf) > > + ffsInf =3D OptRomInfStatement() > > + self._GetInfOptions(ffsInf) > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected INF file path", self.FileName, sel= f.CurrentLineNumber) > > - ffsInf.InfFileName =3D self.__Token > > - if ffsInf.InfFileName.replace('$(WORKSPACE)', '').find('$') = =3D=3D -1: > > + ffsInf.InfFileName =3D self._Token > > + if ffsInf.InfFileName.replace(TAB_WORKSPACE, '').find('$') =3D= =3D -1: > > #check for file path > > ErrorCode, ErrorInfo =3D PathClass(NormPath(ffsInf.InfFile= Name), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > if ErrorCode !=3D 0: > > @@ -4434,71 +4344,71 @@ class FdfParser: > > self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFileN= ame) > > > > > > - self.__GetOptRomOverrides (ffsInf) > > + self._GetOptRomOverrides (ffsInf) > > > > Obj.FfsList.append(ffsInf) > > return True > > > > - ## __GetOptRomOverrides() method > > + ## _GetOptRomOverrides() method > > # > > # Get overrides for OptROM INF & FILE > > # > > # @param self The object pointer > > # @param FfsInfObj for whom overrides is got > > # > > - def __GetOptRomOverrides(self, Obj): > > - if self.__IsToken('{'): > > - Overrides =3D OptRomInfStatement.OverrideAttribs() > > + def _GetOptRomOverrides(self, Obj): > > + if self._IsToken('{'): > > + Overrides =3D OverrideAttribs() > > while True: > > - if self.__IsKeyword( "PCI_VENDOR_ID"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("PCI_VENDOR_ID"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName,= self.CurrentLineNumber) > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex vendor id", self.F= ileName, self.CurrentLineNumber) > > - Overrides.PciVendorId =3D self.__Token > > + Overrides.PciVendorId =3D self._Token > > continue > > > > - if self.__IsKeyword( "PCI_CLASS_CODE"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("PCI_CLASS_CODE"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName,= self.CurrentLineNumber) > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex class code", self.= FileName, self.CurrentLineNumber) > > - Overrides.PciClassCode =3D self.__Token > > + Overrides.PciClassCode =3D self._Token > > continue > > > > - if self.__IsKeyword( "PCI_DEVICE_ID"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("PCI_DEVICE_ID"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName,= self.CurrentLineNumber) > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex device id", self.F= ileName, self.CurrentLineNumber) > > > > - Overrides.PciDeviceId =3D self.__Token > > + Overrides.PciDeviceId =3D self._Token > > continue > > > > - if self.__IsKeyword( "PCI_REVISION"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("PCI_REVISION"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName,= self.CurrentLineNumber) > > - if not self.__GetNextHexNumber(): > > + if not self._GetNextHexNumber(): > > raise Warning("expected Hex revision", self.Fi= leName, self.CurrentLineNumber) > > - Overrides.PciRevision =3D self.__Token > > + Overrides.PciRevision =3D self._Token > > continue > > > > - if self.__IsKeyword( "PCI_COMPRESS"): > > - if not self.__IsToken( "=3D"): > > + if self._IsKeyword("PCI_COMPRESS"): > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > raise Warning("expected '=3D'", self.FileName,= self.CurrentLineNumber) > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected TRUE/FALSE for compres= s", self.FileName, self.CurrentLineNumber) > > - Overrides.NeedCompress =3D self.__Token.upper() = =3D=3D 'TRUE' > > + Overrides.NeedCompress =3D self._Token.upper() =3D= =3D 'TRUE' > > continue > > > > - if self.__IsToken( "}"): > > + if self._IsToken("}"): > > break > > else: > > EdkLogger.error("FdfParser", FORMAT_INVALID, File= =3Dself.FileName, Line=3Dself.CurrentLineNumber) > > > > Obj.OverrideAttribs =3D Overrides > > > > - ## __GetOptRomFileStatement() method > > + ## _GetOptRomFileStatement() method > > # > > # Get FILE statements > > # > > @@ -4507,33 +4417,33 @@ class FdfParser: > > # @retval True Successfully find FILE statement > > # @retval False Not able to find FILE statement > > # > > - def __GetOptRomFileStatement(self, Obj): > > - if not self.__IsKeyword( "FILE"): > > + def _GetOptRomFileStatement(self, Obj): > > + if not self._IsKeyword("FILE"): > > return False > > > > - FfsFileObj =3D OptRomFileStatement.OptRomFileStatement() > > + FfsFileObj =3D OptRomFileStatement() > > > > - if not self.__IsKeyword("EFI") and not self.__IsKeyword(BINARY= _FILE_TYPE_BIN): > > + if not self._IsKeyword("EFI") and not self._IsKeyword(BINARY_F= ILE_TYPE_BIN): > > raise Warning("expected Binary type (EFI/BIN)", self.FileN= ame, self.CurrentLineNumber) > > - FfsFileObj.FileType =3D self.__Token > > + FfsFileObj.FileType =3D self._Token > > > > - if not self.__GetNextToken(): > > + if not self._GetNextToken(): > > raise Warning("expected File path", self.FileName, self.Cu= rrentLineNumber) > > - FfsFileObj.FileName =3D self.__Token > > - if FfsFileObj.FileName.replace('$(WORKSPACE)', '').find('$') = =3D=3D -1: > > + FfsFileObj.FileName =3D self._Token > > + if FfsFileObj.FileName.replace(TAB_WORKSPACE, '').find('$') = =3D=3D -1: > > #check for file path > > ErrorCode, ErrorInfo =3D PathClass(NormPath(FfsFileObj.Fil= eName), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > if ErrorCode !=3D 0: > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DError= Info) > > > > if FfsFileObj.FileType =3D=3D 'EFI': > > - self.__GetOptRomOverrides(FfsFileObj) > > + self._GetOptRomOverrides(FfsFileObj) > > > > Obj.FfsList.append(FfsFileObj) > > > > return True > > > > - ## __GetCapInFd() method > > + ## _GetCapInFd() method > > # > > # Get Cap list contained in FD > > # > > @@ -4541,7 +4451,7 @@ class FdfParser: > > # @param FdName FD name > > # @retval CapList List of Capsule in FD > > # > > - def __GetCapInFd (self, FdName): > > + def _GetCapInFd (self, FdName): > > CapList =3D [] > > if FdName.upper() in self.Profile.FdDict: > > FdObj =3D self.Profile.FdDict[FdName.upper()] > > @@ -4554,7 +4464,7 @@ class FdfParser: > > CapList.append(elementRegionData.upper()) > > return CapList > > > > - ## __GetReferencedFdCapTuple() method > > + ## _GetReferencedFdCapTuple() method > > # > > # Get FV and FD list referenced by a capsule image > > # > > @@ -4563,22 +4473,22 @@ class FdfParser: > > # @param RefFdList referenced FD by section > > # @param RefFvList referenced FV by section > > # > > - def __GetReferencedFdCapTuple(self, CapObj, RefFdList =3D [], RefF= vList =3D []): > > - for CapsuleDataObj in CapObj.CapsuleDataList : > > + def _GetReferencedFdCapTuple(self, CapObj, RefFdList =3D [], RefFv= List =3D []): > > + for CapsuleDataObj in CapObj.CapsuleDataList: > > if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.Fv= Name is not None and CapsuleDataObj.FvName.upper() > not in RefFvList: > > RefFvList.append (CapsuleDataObj.FvName.upper()) > > elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataObj.= FdName is not None and > CapsuleDataObj.FdName.upper() not in RefFdList: > > RefFdList.append (CapsuleDataObj.FdName.upper()) > > elif CapsuleDataObj.Ffs is not None: > > - if isinstance(CapsuleDataObj.Ffs, FfsFileStatement.Fil= eStatement): > > + if isinstance(CapsuleDataObj.Ffs, FileStatement): > > if CapsuleDataObj.Ffs.FvName is not None and Capsu= leDataObj.Ffs.FvName.upper() not in RefFvList: > > RefFvList.append(CapsuleDataObj.Ffs.FvName.upp= er()) > > elif CapsuleDataObj.Ffs.FdName is not None and Cap= suleDataObj.Ffs.FdName.upper() not in RefFdList: > > RefFdList.append(CapsuleDataObj.Ffs.FdName.upp= er()) > > else: > > - self.__GetReferencedFdFvTupleFromSection(Capsu= leDataObj.Ffs, RefFdList, RefFvList) > > + self._GetReferencedFdFvTupleFromSection(Capsul= eDataObj.Ffs, RefFdList, RefFvList) > > > > - ## __GetFvInFd() method > > + ## _GetFvInFd() method > > # > > # Get FV list contained in FD > > # > > @@ -4586,7 +4496,7 @@ class FdfParser: > > # @param FdName FD name > > # @retval FvList list of FV in FD > > # > > - def __GetFvInFd (self, FdName): > > + def _GetFvInFd (self, FdName): > > FvList =3D [] > > if FdName.upper() in self.Profile.FdDict: > > FdObj =3D self.Profile.FdDict[FdName.upper()] > > @@ -4599,7 +4509,7 @@ class FdfParser: > > FvList.append(elementRegionData.upper()) > > return FvList > > > > - ## __GetReferencedFdFvTuple() method > > + ## _GetReferencedFdFvTuple() method > > # > > # Get FD and FV list referenced by a FFS file > > # > > @@ -4608,17 +4518,17 @@ class FdfParser: > > # @param RefFdList referenced FD by section > > # @param RefFvList referenced FV by section > > # > > - def __GetReferencedFdFvTuple(self, FvObj, RefFdList =3D [], RefFvL= ist =3D []): > > + def _GetReferencedFdFvTuple(self, FvObj, RefFdList =3D [], RefFvLi= st =3D []): > > for FfsObj in FvObj.FfsList: > > - if isinstance(FfsObj, FfsFileStatement.FileStatement): > > + if isinstance(FfsObj, FileStatement): > > if FfsObj.FvName is not None and FfsObj.FvName.upper()= not in RefFvList: > > RefFvList.append(FfsObj.FvName.upper()) > > elif FfsObj.FdName is not None and FfsObj.FdName.upper= () not in RefFdList: > > RefFdList.append(FfsObj.FdName.upper()) > > else: > > - self.__GetReferencedFdFvTupleFromSection(FfsObj, R= efFdList, RefFvList) > > + self._GetReferencedFdFvTupleFromSection(FfsObj, Re= fFdList, RefFvList) > > > > - ## __GetReferencedFdFvTupleFromSection() method > > + ## _GetReferencedFdFvTupleFromSection() method > > # > > # Get FD and FV list referenced by a FFS section > > # > > @@ -4627,19 +4537,19 @@ class FdfParser: > > # @param FdList referenced FD by section > > # @param FvList referenced FV by section > > # > > - def __GetReferencedFdFvTupleFromSection(self, FfsFile, FdList =3D = [], FvList =3D []): > > + def _GetReferencedFdFvTupleFromSection(self, FfsFile, FdList =3D [= ], FvList =3D []): > > SectionStack =3D [] > > SectionStack.extend(FfsFile.SectionList) > > while SectionStack !=3D []: > > SectionObj =3D SectionStack.pop() > > - if isinstance(SectionObj, FvImageSection.FvImageSection): > > + if isinstance(SectionObj, FvImageSection): > > if SectionObj.FvName is not None and SectionObj.FvName= .upper() not in FvList: > > FvList.append(SectionObj.FvName.upper()) > > if SectionObj.Fv is not None and SectionObj.Fv.UiFvNam= e is not None and SectionObj.Fv.UiFvName.upper() not in > FvList: > > FvList.append(SectionObj.Fv.UiFvName.upper()) > > - self.__GetReferencedFdFvTuple(SectionObj.Fv, FdLis= t, FvList) > > + self._GetReferencedFdFvTuple(SectionObj.Fv, FdList= , FvList) > > > > - if isinstance(SectionObj, CompressSection.CompressSection)= or isinstance(SectionObj, GuidSection.GuidSection): > > + if isinstance(SectionObj, CompressSection) or isinstance(S= ectionObj, GuidSection): > > SectionStack.extend(SectionObj.SectionList) > > > > ## CycleReferenceCheck() method > > @@ -4662,7 +4572,7 @@ class FdfParser: > > FdAnalyzedList =3D [] > > > > Index =3D 0 > > - while RefFvStack !=3D [] and Index < MaxLength: > > + while RefFvStack and Index < MaxLength: > > Index =3D Index + 1 > > FvNameFromStack =3D RefFvStack.pop() > > if FvNameFromStack.upper() in self.Profile.FvDict: > > @@ -4672,14 +4582,14 @@ class FdfParser: > > > > RefFdList =3D [] > > RefFvList =3D [] > > - self.__GetReferencedFdFvTuple(FvObj, RefFdList, RefFvL= ist) > > + self._GetReferencedFdFvTuple(FvObj, RefFdList, RefFvLi= st) > > > > for RefFdName in RefFdList: > > if RefFdName in FdAnalyzedList: > > continue > > > > LogStr +=3D "FV %s contains FD %s\n" % (FvNameFrom= Stack, RefFdName) > > - FvInFdList =3D self.__GetFvInFd(RefFdName) > > + FvInFdList =3D self._GetFvInFd(RefFdName) > > if FvInFdList !=3D []: > > for FvNameInFd in FvInFdList: > > LogStr +=3D "FD %s contains FV %s\n" % (Re= fFdName, FvNameInFd) > > @@ -4725,7 +4635,7 @@ class FdfParser: > > > > RefFvList =3D [] > > RefFdList =3D [] > > - self.__GetReferencedFdCapTuple(CapObj, RefFdList, RefF= vList) > > + self._GetReferencedFdCapTuple(CapObj, RefFdList, RefFv= List) > > > > FvListLength =3D 0 > > FdListLength =3D 0 > > @@ -4735,7 +4645,7 @@ class FdfParser: > > continue > > > > LogStr +=3D "Capsule %s contains FD %s\n" % (C= apNameFromStack, RefFdName) > > - CapInFdList =3D self.__GetCapInFd(RefFdName) > > + CapInFdList =3D self._GetCapInFd(RefFdName) > > if CapInFdList !=3D []: > > for CapNameInFd in CapInFdList: > > LogStr +=3D "FD %s contains Capsule %s= \n" % (RefFdName, CapNameInFd) > > @@ -4746,7 +4656,7 @@ class FdfParser: > > EdkLogger.info(LogStr) > > return True > > > > - FvInFdList =3D self.__GetFvInFd(RefFdName) > > + FvInFdList =3D self._GetFvInFd(RefFdName) > > if FvInFdList !=3D []: > > for FvNameInFd in FvInFdList: > > LogStr +=3D "FD %s contains FV %s\n" %= (RefFdName, FvNameInFd) > > @@ -4767,7 +4677,7 @@ class FdfParser: > > FvObj =3D self.Profile.FvDict[RefFvName.up= per()] > > else: > > continue > > - self.__GetReferencedFdFvTuple(FvObj, RefFdList= , RefFvList) > > + self._GetReferencedFdFvTuple(FvObj, RefFdList,= RefFvList) > > FvAnalyzedList.append(RefFvName) > > > > return False > > diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/P= ython/GenFds/Ffs.py > > index 598b2d023124..4c1b43572964 100644 > > --- a/BaseTools/Source/Python/GenFds/Ffs.py > > +++ b/BaseTools/Source/Python/GenFds/Ffs.py > > @@ -15,53 +15,41 @@ > > ## > > # Import Modules > > # > > -from CommonDataClass.FdfClass import FDClassObject > > from Common.DataType import * > > > > -## generate FFS > > -# > > -# > > -class Ffs(FDClassObject): > > - # mapping between FILE type in FDF and file type for GenFfs > > - FdfFvFileTypeToFileType =3D { > > - SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE'= , > > - SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', > > - SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', > > - SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', > > - 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', > > - 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', > > - 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', > > - 'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE', > > - 'RAW' : 'EFI_FV_FILETYPE_RAW', > > - 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', > > - 'SMM' : 'EFI_FV_FILETYPE_SMM', > > - SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', > > - SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE'= , > > - SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STAND= ALONE' > > - } > > +# mapping between FILE type in FDF and file type for GenFfs > > +FdfFvFileTypeToFileType =3D { > > + SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', > > + SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', > > + SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', > > + SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', > > + 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', > > + 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', > > + 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', > > + 'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE', > > + 'RAW' : 'EFI_FV_FILETYPE_RAW', > > + 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', > > + 'SMM' : 'EFI_FV_FILETYPE_SMM', > > + SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', > > + SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE', > > + SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALON= E' > > +} > > > > - # mapping between section type in FDF and file suffix > > - SectionSuffix =3D { > > - BINARY_FILE_TYPE_PE32 : '.pe32', > > - BINARY_FILE_TYPE_PIC : '.pic', > > - BINARY_FILE_TYPE_TE : '.te', > > - BINARY_FILE_TYPE_DXE_DEPEX : '.dpx', > > - 'VERSION' : '.ver', > > - BINARY_FILE_TYPE_UI : '.ui', > > - 'COMPAT16' : '.com16', > > - 'RAW' : '.raw', > > - 'FREEFORM_SUBTYPE_GUID': '.guid', > > - 'SUBTYPE_GUID' : '.guid', > > - 'FV_IMAGE' : 'fv.sec', > > - 'COMPRESS' : '.com', > > - 'GUIDED' : '.guided', > > - BINARY_FILE_TYPE_PEI_DEPEX : '.dpx', > > - BINARY_FILE_TYPE_SMM_DEPEX : '.dpx' > > - } > > - > > - ## The constructor > > - # > > - # @param self The object pointer > > - # > > - def __init__(self): > > - FfsClassObject.__init__(self) > > +# mapping between section type in FDF and file suffix > > +SectionSuffix =3D { > > + BINARY_FILE_TYPE_PE32 : '.pe32', > > + BINARY_FILE_TYPE_PIC : '.pic', > > + BINARY_FILE_TYPE_TE : '.te', > > + BINARY_FILE_TYPE_DXE_DEPEX : '.dpx', > > + 'VERSION' : '.ver', > > + BINARY_FILE_TYPE_UI : '.ui', > > + 'COMPAT16' : '.com16', > > + 'RAW' : '.raw', > > + 'FREEFORM_SUBTYPE_GUID': '.guid', > > + 'SUBTYPE_GUID' : '.guid', > > + 'FV_IMAGE' : 'fv.sec', > > + 'COMPRESS' : '.com', > > + 'GUIDED' : '.guided', > > + BINARY_FILE_TYPE_PEI_DEPEX : '.dpx', > > + BINARY_FILE_TYPE_SMM_DEPEX : '.dpx' > > +} > > diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseT= ools/Source/Python/GenFds/FfsFileStatement.py > > index 4c35aac76a00..7479efff04c7 100644 > > --- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py > > +++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py > > @@ -16,26 +16,22 @@ > > # Import Modules > > # > > from __future__ import absolute_import > > -from . import Ffs > > -from . import Rule > > -import Common.LongFilePathOs as os > > from io import BytesIO > > -import subprocess > > - > > -from .GenFdsGlobalVariable import GenFdsGlobalVariable > > +from struct import pack > > from CommonDataClass.FdfClass import FileStatementClassObject > > from Common import EdkLogger > > -from Common.BuildToolError import * > > -from Common.Misc import GuidStructureByteArrayToGuidString > > +from Common.BuildToolError import GENFDS_ERROR > > +from Common.Misc import GuidStructureByteArrayToGuidString, SaveFileOn= Change > > +import Common.LongFilePathOs as os > > from .GuidSection import GuidSection > > from .FvImageSection import FvImageSection > > -from Common.Misc import SaveFileOnChange > > -from struct import * > > +from .Ffs import FdfFvFileTypeToFileType > > +from .GenFdsGlobalVariable import GenFdsGlobalVariable > > > > ## generate FFS from FILE > > # > > # > > -class FileStatement (FileStatementClassObject) : > > +class FileStatement (FileStatementClassObject): > > ## The constructor > > # > > # @param self The object pointer > > @@ -60,7 +56,7 @@ class FileStatement (FileStatementClassObject) : > > # > > def GenFfs(self, Dict =3D {}, FvChildAddr=3D[], FvParentAddr=3DNon= e, IsMakefile=3DFalse, FvName=3DNone): > > > > - if self.NameGuid is not None and self.NameGuid.startswith('PCD= ('): > > + if self.NameGuid and self.NameGuid.startswith('PCD('): > > PcdValue =3D GenFdsGlobalVariable.GetPcdValue(self.NameGui= d) > > if len(PcdValue) =3D=3D 0: > > EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT define= d.' \ > > @@ -82,7 +78,7 @@ class FileStatement (FileStatementClassObject) : > > > > Dict.update(self.DefineVarDict) > > SectionAlignments =3D None > > - if self.FvName is not None : > > + if self.FvName: > > Buffer =3D BytesIO('') > > if self.FvName.upper() not in GenFdsGlobalVariable.FdfPars= er.Profile.FvDict: > > EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NO= T described in FDF file!" % (self.FvName)) > > @@ -90,14 +86,14 @@ class FileStatement (FileStatementClassObject) : > > FileName =3D Fv.AddToBuffer(Buffer) > > SectionFiles =3D [FileName] > > > > - elif self.FdName is not None: > > + elif self.FdName: > > if self.FdName.upper() not in GenFdsGlobalVariable.FdfPars= er.Profile.FdDict: > > EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NO= T described in FDF file!" % (self.FdName)) > > Fd =3D GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(s= elf.FdName.upper()) > > FileName =3D Fd.GenFd() > > SectionFiles =3D [FileName] > > > > - elif self.FileName is not None: > > + elif self.FileName: > > if hasattr(self, 'FvFileType') and self.FvFileType =3D=3D = 'RAW': > > if isinstance(self.FileName, list) and isinstance(self= .SubAlignment, list) and len(self.FileName) =3D=3D > len(self.SubAlignment): > > FileContent =3D '' > > @@ -111,7 +107,7 @@ class FileStatement (FileStatementClassObject) : > > Content =3D f.read() > > f.close() > > AlignValue =3D 1 > > - if self.SubAlignment[Index] is not None: > > + if self.SubAlignment[Index]: > > AlignValue =3D GenFdsGlobalVariable.GetAli= gnment(self.SubAlignment[Index]) > > if AlignValue > MaxAlignValue: > > MaxAlignIndex =3D Index > > @@ -143,7 +139,7 @@ class FileStatement (FileStatementClassObject) : > > SectionFiles =3D [] > > Index =3D 0 > > SectionAlignments =3D [] > > - for section in self.SectionList : > > + for section in self.SectionList: > > Index =3D Index + 1 > > SecIndex =3D '%d' %Index > > # process the inside FvImage from FvSection or GuidSec= tion > > @@ -152,7 +148,7 @@ class FileStatement (FileStatementClassObject) : > > section.FvAddr =3D FvChildAddr.pop(0) > > elif isinstance(section, GuidSection): > > section.FvAddr =3D FvChildAddr > > - if FvParentAddr is not None and isinstance(section, Gu= idSection): > > + if FvParentAddr and isinstance(section, GuidSection): > > section.FvParentAddr =3D FvParentAddr > > > > if self.KeepReloc =3D=3D False: > > @@ -168,7 +164,7 @@ class FileStatement (FileStatementClassObject) : > > # > > FfsFileOutput =3D os.path.join(OutputDir, self.NameGuid + '.ff= s') > > GenFdsGlobalVariable.GenerateFfs(FfsFileOutput, SectionFiles, > > - Ffs.Ffs.FdfFvFileTypeToFileTy= pe.get(self.FvFileType), > > + FdfFvFileTypeToFileType.get(s= elf.FvFileType), > > self.NameGuid, > > Fixed=3Dself.Fixed, > > CheckSum=3Dself.CheckSum, > > @@ -177,6 +173,3 @@ class FileStatement (FileStatementClassObject) : > > ) > > > > return FfsFileOutput > > - > > - > > - > > diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTo= ols/Source/Python/GenFds/FfsInfStatement.py > > index 6149bc81b4ef..c1073c96e9aa 100644 > > --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py > > +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py > > @@ -22,7 +22,7 @@ import Common.LongFilePathOs as os > > from io import BytesIO > > from struct import * > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > -from . import Ffs > > +from .Ffs import SectionSuffix,FdfFvFileTypeToFileType > > import subprocess > > import sys > > from . import Section > > @@ -760,7 +760,7 @@ class FfsInfStatement(FfsInfStatementClassObject): > > > > SecNum =3D '%d' %Index > > GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid= ) + \ > > - Ffs.Ffs.SectionSuffix[SectionType] + SUP= _MODULE_SEC + SecNum > > + SectionSuffix[SectionType] + SUP_MODULE_= SEC + SecNum > > Index =3D Index + 1 > > OutputFile =3D os.path.join(self.OutputPath, GenSecOut= putFile) > > File =3D GenFdsGlobalVariable.MacroExtend(File, Dict, = self.CurrentArch) > > @@ -803,7 +803,7 @@ class FfsInfStatement(FfsInfStatementClassObject): > > else: > > SecNum =3D '%d' %Index > > GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid) + = \ > > - Ffs.Ffs.SectionSuffix[SectionType] + SUP= _MODULE_SEC + SecNum > > + SectionSuffix[SectionType] + SUP_MODULE_= SEC + SecNum > > OutputFile =3D os.path.join(self.OutputPath, GenSecOutputF= ile) > > GenSecInputFile =3D GenFdsGlobalVariable.MacroExtend(GenSe= cInputFile, Dict, self.CurrentArch) > > > > @@ -882,7 +882,7 @@ class FfsInfStatement(FfsInfStatementClassObject): > > self.ModuleGuid =3D RegistryGuidStr > > > > GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputSection, > > - Ffs.Ffs.FdfFvFileTypeToFi= leType[Rule.FvFileType], > > + FdfFvFileTypeToFileType[R= ule.FvFileType], > > self.ModuleGuid, Fixed=3D= Rule.Fixed, > > CheckSum=3DRule.CheckSum,= Align=3DRule.Alignment, > > SectionAlign=3DSectionAli= gnments, > > @@ -1055,7 +1055,7 @@ class FfsInfStatement(FfsInfStatementClassObject)= : > > > > FfsOutput =3D os.path.join( self.OutputPath, self.ModuleGuid += '.ffs') > > GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputFile, > > - Ffs.Ffs.FdfFvFileTypeToFi= leType[Rule.FvFileType], > > + FdfFvFileTypeToFileType[R= ule.FvFileType], > > self.ModuleGuid, Fixed=3D= Rule.Fixed, > > CheckSum=3DRule.CheckSum,= Align=3DRule.Alignment, > > SectionAlign=3DAlignments= , > > diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Py= thon/GenFds/Fv.py > > index c66fc383278d..30525bd11fcc 100644 > > --- a/BaseTools/Source/Python/GenFds/Fv.py > > +++ b/BaseTools/Source/Python/GenFds/Fv.py > > @@ -1,4 +1,3 @@ > > -from __future__ import absolute_import > > ## @file > > # process FV generation > > # > > @@ -16,16 +15,13 @@ from __future__ import absolute_import > > ## > > # Import Modules > > # > > +from __future__ import absolute_import > > import Common.LongFilePathOs as os > > import subprocess > > from io import BytesIO > > from struct import * > > - > > -from . import Ffs > > -from . import AprioriSection > > from . import FfsFileStatement > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > -from CommonDataClass.FdfClass import FvClassObject > > from Common.Misc import SaveFileOnChange, PackGUID > > from Common.LongFilePathSupport import CopyLongFilePath > > from Common.LongFilePathSupport import OpenLongFilePath as open > > @@ -36,13 +32,25 @@ FV_UI_EXT_ENTY_GUID =3D 'A67DF1FA-8DE8-4E98-AF09-4B= DF2EFFBC7C' > > ## generate FV > > # > > # > > -class FV (FvClassObject): > > +class FV (object): > > ## The constructor > > # > > # @param self The object pointer > > # > > def __init__(self): > > - FvClassObject.__init__(self) > > + self.UiFvName =3D None > > + self.CreateFileName =3D None > > + self.BlockSizeList =3D [] > > + self.DefineVarDict =3D {} > > + self.SetVarDict =3D {} > > + self.FvAlignment =3D None > > + self.FvAttributeDict =3D {} > > + self.FvNameGuid =3D None > > + self.FvNameString =3D None > > + self.AprioriSectionList =3D [] > > + self.FfsList =3D [] > > + self.BsBaseAddress =3D None > > + self.RtBaseAddress =3D None > > self.FvInfFile =3D None > > self.FvAddressFile =3D None > > self.BaseAddress =3D None > > @@ -68,7 +76,7 @@ class FV (FvClassObject): > > # @param MacroDict macro value pair > > # @retval string Generated FV file path > > # > > - def AddToBuffer (self, Buffer, BaseAddress=3DNone, BlockSize=3D No= ne, BlockNum=3DNone, ErasePloarity=3D'1', VtfDict=3DNone, MacroDict > =3D {}, Flag=3DFalse) : > > + def AddToBuffer (self, Buffer, BaseAddress=3DNone, BlockSize=3D No= ne, BlockNum=3DNone, ErasePloarity=3D'1', VtfDict=3DNone, > MacroDict =3D {}, Flag=3DFalse): > > > > if BaseAddress is None and self.UiFvName.upper() + 'fv' in Gen= FdsGlobalVariable.ImageBinDict: > > return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upp= er() + 'fv'] > > @@ -96,7 +104,7 @@ class FV (FvClassObject): > > if self.FvBaseAddress is not None: > > BaseAddress =3D self.FvBaseAddress > > if not Flag: > > - self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, E= rasePloarity, VtfDict) > > + self._InitializeInf(BaseAddress, BlockSize, BlockNum, Eras= ePloarity, VtfDict) > > # > > # First Process the Apriori section > > # > > @@ -114,7 +122,7 @@ class FV (FvClassObject): > > TAB_LINE_BREAK) > > > > # Process Modules in FfsList > > - for FfsFile in self.FfsList : > > + for FfsFile in self.FfsList: > > if Flag: > > if isinstance(FfsFile, FfsFileStatement.FileStatement)= : > > continue > > @@ -177,7 +185,7 @@ class FV (FvClassObject): > > > > if FvChildAddr !=3D []: > > # Update Ffs again > > - for FfsFile in self.FfsList : > > + for FfsFile in self.FfsList: > > FileName =3D FfsFile.GenFfs(MacroDict, FvChild= Addr, BaseAddress, IsMakefile=3DFlag, > FvName=3Dself.UiFvName) > > > > if GenFdsGlobalVariable.LargeFileInFvFlags[-1]: > > @@ -252,7 +260,7 @@ class FV (FvClassObject): > > return True > > return False > > > > - ## __InitializeInf__() > > + ## _InitializeInf() > > # > > # Initilize the inf file to create FV > > # > > @@ -263,7 +271,7 @@ class FV (FvClassObject): > > # @param ErasePolarity Flash erase polarity > > # @param VtfDict VTF objects > > # > > - def __InitializeInf__ (self, BaseAddress =3D None, BlockSize=3D No= ne, BlockNum =3D None, ErasePloarity=3D'1', VtfDict=3DNone) : > > + def _InitializeInf (self, BaseAddress =3D None, BlockSize=3D None,= BlockNum =3D None, ErasePloarity=3D'1', VtfDict=3DNone): > > # > > # Create FV inf file > > # > > @@ -275,7 +283,7 @@ class FV (FvClassObject): > > # Add [Options] > > # > > self.FvInfFile.writelines("[options]" + TAB_LINE_BREAK) > > - if BaseAddress is not None : > > + if BaseAddress is not None: > > self.FvInfFile.writelines("EFI_BASE_ADDRESS =3D " + \ > > BaseAddress + \ > > TAB_LINE_BREAK) > > @@ -294,7 +302,7 @@ class FV (FvClassObject): > > #set default block size is 1 > > self.FvInfFile.writelines("EFI_BLOCK_SIZE =3D 0x1= " + TAB_LINE_BREAK) > > > > - for BlockSize in self.BlockSizeList : > > + for BlockSize in self.BlockSizeList: > > if BlockSize[0] is not None: > > self.FvInfFile.writelines("EFI_BLOCK_SIZE =3D " = + \ > > '0x%X' %BlockSize[0] + \ > > @@ -320,9 +328,9 @@ class FV (FvClassObject): > > ' %s' %ErasePloarity + \ > > TAB_LINE_BREAK) > > if not (self.FvAttributeDict is None): > > - for FvAttribute in self.FvAttributeDict.keys() : > > + for FvAttribute in self.FvAttributeDict.keys(): > > if FvAttribute =3D=3D "FvUsedSizeEnable": > > - if self.FvAttributeDict[FvAttribute].upper() in ('= TRUE', '1') : > > + if self.FvAttributeDict[FvAttribute].upper() in ('= TRUE', '1'): > > self.UsedSizeEnable =3D True > > continue > > self.FvInfFile.writelines("EFI_" + \ > > @@ -365,8 +373,8 @@ class FV (FvClassObject): > > Guid =3D FV_UI_EXT_ENTY_GUID.split('-') > > # > > # Layout: > > - # EFI_FIRMWARE_VOLUME_EXT_ENTRY : size 4 > > - # GUID : size 16 > > + # EFI_FIRMWARE_VOLUME_EXT_ENTRY: size 4 > > + # GUID: size 16 > > # FV UI name > > # > > Buffer +=3D (pack('HH', (FvUiLen + 16 + 4), 0x0002) > > @@ -422,7 +430,6 @@ class FV (FvClassObject): > > FvExtHeaderFileName = + \ > > TAB_LINE_BREAK) > > > > - > > # > > # Add [Files] > > # > > diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseToo= ls/Source/Python/GenFds/FvImageSection.py > > index 04556fc87099..d6e1f3315b7e 100644 > > --- a/BaseTools/Source/Python/GenFds/FvImageSection.py > > +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py > > @@ -18,7 +18,7 @@ > > from __future__ import absolute_import > > from . import Section > > from io import BytesIO > > -from .Ffs import Ffs > > +from .Ffs import SectionSuffix > > import subprocess > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > import Common.LongFilePathOs as os > > @@ -76,7 +76,7 @@ class FvImageSection(FvImageSectionClassObject): > > if FvAlignmentValue > MaxFvAlignment: > > MaxFvAlignment =3D FvAlignmentValue > > > > - OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + > Ffs.SectionSuffix.get("FV_IMAGE")) > > + OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + > SectionSuffix.get("FV_IMAGE")) > > GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFi= leName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', > IsMakefile=3DIsMakefile) > > OutputFileList.append(OutputFile) > > > > @@ -146,7 +146,7 @@ class FvImageSection(FvImageSectionClassObject): > > # > > # Prepare the parameter of GenSection > > # > > - OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_M= ODULE_SEC + SecNum + > Ffs.SectionSuffix.get("FV_IMAGE")) > > + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_M= ODULE_SEC + SecNum + SectionSuffix.get("FV_IMAGE")) > > GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileNa= me], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', > IsMakefile=3DIsMakefile) > > OutputFileList.append(OutputFile) > > > > diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Sourc= e/Python/GenFds/GenFds.py > > index 9dec9c5eb57d..0c8091b79841 100644 > > --- a/BaseTools/Source/Python/GenFds/GenFds.py > > +++ b/BaseTools/Source/Python/GenFds/GenFds.py > > @@ -17,34 +17,30 @@ > > # > > from __future__ import print_function > > from __future__ import absolute_import > > +from re import compile > > from optparse import OptionParser > > -import sys > > -import Common.LongFilePathOs as os > > -import linecache > > -from . import FdfParser > > -import Common.BuildToolError as BuildToolError > > -from .GenFdsGlobalVariable import GenFdsGlobalVariable > > -from Workspace.WorkspaceDatabase import WorkspaceDatabase > > -from Workspace.BuildClassObject import PcdClassObject > > -from . import RuleComplexFile > > -from .EfiSection import EfiSection > > +from sys import exit > > +from glob import glob > > +from struct import unpack > > +from linecache import getlines > > from io import BytesIO > > -import Common.TargetTxtClassObject as TargetTxtClassObject > > -import Common.ToolDefClassObject as ToolDefClassObject > > + > > +import Common.LongFilePathOs as os > > +from Common.TargetTxtClassObject import TargetTxtClassObject > > from Common.DataType import * > > import Common.GlobalData as GlobalData > > from Common import EdkLogger > > -from Common.StringUtils import * > > -from Common.Misc import DirCache, PathClass > > -from Common.Misc import SaveFileOnChange > > -from Common.Misc import ClearDuplicatedInf > > -from Common.Misc import GuidStructureStringToGuidString > > +from Common.StringUtils import NormPath > > +from Common.Misc import DirCache, PathClass, GuidStructureStringToGuid= String > > +from Common.Misc import SaveFileOnChange, ClearDuplicatedInf > > from Common.BuildVersion import gBUILD_VERSION > > from Common.MultipleWorkspace import MultipleWorkspace as mws > > -from . import FfsFileStatement > > -import glob > > -from struct import unpack > > -from Common.GlobalData import gGuidPattern > > +from Common.BuildToolError import FatalError, GENFDS_ERROR, CODE_ERROR= , FORMAT_INVALID, RESOURCE_NOT_AVAILABLE, > FILE_NOT_FOUND, OPTION_MISSING, FORMAT_NOT_SUPPORTED,OPTION_VALUE_INVALID > > +from Workspace.WorkspaceDatabase import WorkspaceDatabase > > + > > +from .FdfParser import FdfParser, Warning > > +from .GenFdsGlobalVariable import GenFdsGlobalVariable > > +from .FfsFileStatement import FileStatement > > > > ## Version and Copyright > > versionNumber =3D "1.0" + ' ' + gBUILD_VERSION > > @@ -71,22 +67,22 @@ def main(): > > > > EdkLogger.Initialize() > > try: > > - if Options.verbose is not None: > > + if Options.verbose: > > EdkLogger.SetLevel(EdkLogger.VERBOSE) > > GenFdsGlobalVariable.VerboseMode =3D True > > > > - if Options.FixedAddress is not None: > > + if Options.FixedAddress: > > GenFdsGlobalVariable.FixedLoadAddress =3D True > > > > - if Options.quiet is not None: > > + if Options.quiet: > > EdkLogger.SetLevel(EdkLogger.QUIET) > > - if Options.debug is not None: > > + if Options.debug: > > EdkLogger.SetLevel(Options.debug + 1) > > GenFdsGlobalVariable.DebugLevel =3D Options.debug > > else: > > EdkLogger.SetLevel(EdkLogger.INFO) > > > > - if (Options.Workspace is None): > > + if not Options.Workspace: > > EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not d= efined", > > ExtraData=3D"Please use '-w' switch to pas= s it or set the WORKSPACE environment variable.") > > elif not os.path.exists(Options.Workspace): > > @@ -97,7 +93,7 @@ def main(): > > GenFdsGlobalVariable.WorkSpaceDir =3D Workspace > > if 'EDK_SOURCE' in os.environ: > > GenFdsGlobalVariable.EdkSourceDir =3D os.path.normcase= (os.environ['EDK_SOURCE']) > > - if (Options.debug): > > + if Options.debug: > > GenFdsGlobalVariable.VerboseLogger("Using Workspace:" = + Workspace) > > if Options.GenfdsMultiThread: > > GenFdsGlobalVariable.EnableGenfdsMultiThread =3D True > > @@ -107,7 +103,7 @@ def main(): > > PackagesPath =3D os.getenv("PACKAGES_PATH") > > mws.setWs(GenFdsGlobalVariable.WorkSpaceDir, PackagesPath) > > > > - if (Options.filename): > > + if Options.filename: > > FdfFilename =3D Options.filename > > FdfFilename =3D GenFdsGlobalVariable.ReplaceWorkspaceMacro= (FdfFilename) > > > > @@ -123,13 +119,13 @@ def main(): > > else: > > EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF fil= ename") > > > > - if (Options.BuildTarget): > > + if Options.BuildTarget: > > GenFdsGlobalVariable.TargetName =3D Options.BuildTarget > > > > - if (Options.ToolChain): > > + if Options.ToolChain: > > GenFdsGlobalVariable.ToolChainTag =3D Options.ToolChain > > > > - if (Options.activePlatform): > > + if Options.activePlatform: > > ActivePlatform =3D Options.activePlatform > > ActivePlatform =3D GenFdsGlobalVariable.ReplaceWorkspaceMa= cro(ActivePlatform) > > > > @@ -139,15 +135,15 @@ def main(): > > if not os.path.isabs (ActivePlatform): > > ActivePlatform =3D mws.join(GenFdsGlobalVariable.WorkS= paceDir, ActivePlatform) > > > > - if not os.path.exists(ActivePlatform) : > > + if not os.path.exists(ActivePlatform): > > EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatf= orm doesn't exist!") > > else: > > EdkLogger.error("GenFds", OPTION_MISSING, "Missing active = platform") > > > > - GlobalData.BuildOptionPcd =3D Options.OptionPcd if Options= .OptionPcd else {} > > + GlobalData.BuildOptionPcd =3D Options.OptionPcd if Options.Opt= ionPcd else {} > > GenFdsGlobalVariable.ActivePlatform =3D PathClass(NormPath(Act= ivePlatform)) > > > > - if (Options.ConfDirectory): > > + if Options.ConfDirectory: > > # Get alternate Conf location, if it is absolute, then jus= t use the absolute directory name > > ConfDirectoryPath =3D os.path.normpath(Options.ConfDirecto= ry) > > if ConfDirectoryPath.startswith('"'): > > @@ -169,7 +165,7 @@ def main(): > > GlobalData.gConfDirectory =3D GenFdsGlobalVariable.ConfDir > > BuildConfigurationFile =3D os.path.normpath(os.path.join(ConfD= irectoryPath, "target.txt")) > > if os.path.isfile(BuildConfigurationFile) =3D=3D True: > > - TargetTxt =3D TargetTxtClassObject.TargetTxtClassObject() > > + TargetTxt =3D TargetTxtClassObject() > > TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) > > # if no build target given in command line, get it from ta= rget.txt > > if not GenFdsGlobalVariable.TargetName: > > @@ -237,10 +233,9 @@ def main(): > > GlobalData.gAllFiles =3D DirCache(Workspace) > > GlobalData.gWorkspace =3D Workspace > > > > - if (Options.archList) : > > + if Options.archList: > > ArchList =3D Options.archList.split(',') > > else: > > -# EdkLogger.error("GenFds", OPTION_MISSING, "Missing build = ARCH") > > ArchList =3D BuildWorkSpace.BuildObject[GenFdsGlobalVariab= le.ActivePlatform, TAB_COMMON, Options.BuildTarget, > Options.ToolChain].SupArchList > > > > TargetArchList =3D set(BuildWorkSpace.BuildObject[GenFdsGlobal= Variable.ActivePlatform, TAB_COMMON, > Options.BuildTarget, Options.ToolChain].SupArchList) & set(ArchList) > > @@ -249,9 +244,11 @@ def main(): > > > > for Arch in ArchList: > > GenFdsGlobalVariable.OutputDirFromDscDict[Arch] =3D > NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, = Arch, Options.BuildTarget, > Options.ToolChain].OutputDirectory) > > - GenFdsGlobalVariable.PlatformName =3D BuildWorkSpace.Build= Object[GenFdsGlobalVariable.ActivePlatform, Arch, > Options.BuildTarget, Options.ToolChain].PlatformName > > > > - if (Options.outputDir): > > + # assign platform name based on last entry in ArchList > > + GenFdsGlobalVariable.PlatformName =3D BuildWorkSpace.BuildObje= ct[GenFdsGlobalVariable.ActivePlatform, ArchList[-1], > Options.BuildTarget, Options.ToolChain].PlatformName > > + > > + if Options.outputDir: > > OutputDirFromCommandLine =3D GenFdsGlobalVariable.ReplaceW= orkspaceMacro(Options.outputDir) > > if not os.path.isabs (OutputDirFromCommandLine): > > OutputDirFromCommandLine =3D os.path.join(GenFdsGlobal= Variable.WorkSpaceDir, OutputDirFromCommandLine) > > @@ -274,27 +271,27 @@ def main(): > > GenFdsGlobalVariable.OutputDirDict[Key] =3D OutputDir > > > > """ Parse Fdf file, has to place after build Workspace as FDF = may contain macros from DSC file """ > > - FdfParserObj =3D FdfParser.FdfParser(FdfFilename) > > + FdfParserObj =3D FdfParser(FdfFilename) > > FdfParserObj.ParseFile() > > > > if FdfParserObj.CycleReferenceCheck(): > > EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Ref= erence Detected in FDF file") > > > > - if (Options.uiFdName) : > > + if Options.uiFdName: > > if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict= : > > GenFds.OnlyGenerateThisFd =3D Options.uiFdName > > else: > > EdkLogger.error("GenFds", OPTION_VALUE_INVALID, > > "No such an FD in FDF file: %s" % Opti= ons.uiFdName) > > > > - if (Options.uiFvName) : > > + if Options.uiFvName: > > if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict= : > > GenFds.OnlyGenerateThisFv =3D Options.uiFvName > > else: > > EdkLogger.error("GenFds", OPTION_VALUE_INVALID, > > "No such an FV in FDF file: %s" % Opti= ons.uiFvName) > > > > - if (Options.uiCapName) : > > + if Options.uiCapName: > > if Options.uiCapName.upper() in FdfParserObj.Profile.Capsu= leDict: > > GenFds.OnlyGenerateThisCap =3D Options.uiCapName > > else: > > @@ -302,7 +299,7 @@ def main(): > > "No such a Capsule in FDF file: %s" % = Options.uiCapName) > > > > GenFdsGlobalVariable.WorkSpace =3D BuildWorkSpace > > - if ArchList is not None: > > + if ArchList: > > GenFdsGlobalVariable.ArchList =3D ArchList > > > > # Dsc Build Data will handle Pcd Settings from CommandLine. > > @@ -313,10 +310,8 @@ def main(): > > > > # Record the FV Region info that may specific in the FD > > if FdfParserObj.Profile.FvDict and FdfParserObj.Profile.FdDict= : > > - for Fv in FdfParserObj.Profile.FvDict: > > - FvObj =3D FdfParserObj.Profile.FvDict[Fv] > > - for Fd in FdfParserObj.Profile.FdDict: > > - FdObj =3D FdfParserObj.Profile.FdDict[Fd] > > + for FvObj in FdfParserObj.Profile.FvDict.values(): > > + for FdObj in FdfParserObj.Profile.FdDict.values(): > > for RegionObj in FdObj.RegionList: > > if RegionObj.RegionType !=3D BINARY_FILE_TYPE_= FV: > > continue > > @@ -338,7 +333,7 @@ def main(): > > """Display FV space info.""" > > GenFds.DisplayFvSpaceInfo(FdfParserObj) > > > > - except FdfParser.Warning as X: > > + except Warning as X: > > EdkLogger.error(X.ToolName, FORMAT_INVALID, File=3DX.FileName,= Line=3DX.LineNumber, ExtraData=3DX.Message, > RaiseError=3DFalse) > > ReturnCode =3D FORMAT_INVALID > > except FatalError as X: > > @@ -374,7 +369,6 @@ def SingleCheckCallback(option, opt_str, value, par= ser): > > # Using standard Python module optparse to parse command line option o= f this tool. > > # > > # @retval Opt A optparse.Values object containing the parsed optio= ns > > -# @retval Args Target of build command > > # > > def myOptionParser(): > > usage =3D "%prog [options] -f input_file -a arch_list -b build_tar= get -p active_platform -t tool_chain_tag -D \"MacroName [=3D > MacroValue]\"" > > @@ -404,7 +398,7 @@ def myOptionParser(): > > Parser.add_option("--pcd", action=3D"append", dest=3D"OptionPcd", = help=3D"Set PCD value by command line. Format: > \"PcdName=3DValue\" ") > > Parser.add_option("--genfds-multi-thread", action=3D"store_true", = dest=3D"GenfdsMultiThread", default=3DFalse, help=3D"Enable GenFds > multi thread to generate ffs file.") > > > > - (Options, args) =3D Parser.parse_args() > > + Options, _ =3D Parser.parse_args() > > return Options > > > > ## The class implementing the EDK2 flash image generation process > > @@ -414,7 +408,7 @@ def myOptionParser(): > > # 2. Call methods of Fd class to generate FD > > # 3. Call methods of Fv class to generate FV that not belong to = FD > > # > > -class GenFds : > > +class GenFds(object): > > FdfParsef =3D None > > OnlyGenerateThisFd =3D None > > OnlyGenerateThisFv =3D None > > @@ -423,12 +417,13 @@ class GenFds : > > ## GenFd() > > # > > # @param OutputDir Output directory > > - # @param FdfParser FDF contents parser > > + # @param FdfParserObject FDF contents parser > > # @param Workspace The directory of workspace > > # @param ArchList The Arch list of platform > > # > > - def GenFd (OutputDir, FdfParser, WorkSpace, ArchList): > > - GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchLis= t) > > + @staticmethod > > + def GenFd (OutputDir, FdfParserObject, WorkSpace, ArchList): > > + GenFdsGlobalVariable.SetDir ('', FdfParserObject, WorkSpace, A= rchList) > > > > GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images an= d their required FV and Capsule images!") > > if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGener= ateThisCap.upper() in > GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict: > > @@ -470,9 +465,10 @@ class GenFds : > > GenFdsGlobalVariable.VerboseLogger("\n Generate all Op= tion ROM!") > > for OptRomObj in GenFdsGlobalVariable.FdfParser.Profil= e.OptRomDict.values(): > > OptRomObj.AddToBuffer(None) > > + > > @staticmethod > > - def GenFfsMakefile(OutputDir, FdfParser, WorkSpace, ArchList, Glob= alData): > > - GenFdsGlobalVariable.SetEnv(FdfParser, WorkSpace, ArchList, Gl= obalData) > > + def GenFfsMakefile(OutputDir, FdfParserObject, WorkSpace, ArchList= , GlobalData): > > + GenFdsGlobalVariable.SetEnv(FdfParserObject, WorkSpace, ArchLi= st, GlobalData) > > for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.val= ues(): > > FdObj.GenFd(Flag=3DTrue) > > > > @@ -490,6 +486,7 @@ class GenFds : > > # @param FvObj Whose block size to get > > # @retval int Block size value > > # > > + @staticmethod > > def GetFvBlockSize(FvObj): > > DefaultBlockSize =3D 0x1 > > FdObj =3D None > > @@ -524,16 +521,17 @@ class GenFds : > > # @param FvObj Whose block size to get > > # @retval None > > # > > - def DisplayFvSpaceInfo(FdfParser): > > + @staticmethod > > + def DisplayFvSpaceInfo(FdfParserObject): > > > > FvSpaceInfoList =3D [] > > MaxFvNameLength =3D 0 > > - for FvName in FdfParser.Profile.FvDict: > > + for FvName in FdfParserObject.Profile.FvDict: > > if len(FvName) > MaxFvNameLength: > > MaxFvNameLength =3D len(FvName) > > FvSpaceInfoFileName =3D os.path.join(GenFdsGlobalVariable.= FvDir, FvName.upper() + '.Fv.map') > > if os.path.exists(FvSpaceInfoFileName): > > - FileLinesList =3D linecache.getlines(FvSpaceInfoFileNa= me) > > + FileLinesList =3D getlines(FvSpaceInfoFileName) > > TotalFound =3D False > > Total =3D '' > > UsedFound =3D False > > @@ -575,6 +573,7 @@ class GenFds : > > # @param DscFile modules from dsc file will be preproce= ssed > > # @retval None > > # > > + @staticmethod > > def PreprocessImage(BuildDb, DscFile): > > PcdDict =3D BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlo= balVariable.TargetName, > GenFdsGlobalVariable.ToolChainTag].Pcds > > PcdValue =3D '' > > @@ -600,6 +599,7 @@ class GenFds : > > ModuleObj =3D BuildDb.BuildObject[Key, TAB_COMMON, GenFdsG= lobalVariable.TargetName, > GenFdsGlobalVariable.ToolChainTag] > > print(ModuleObj.BaseName + ' ' + ModuleObj.ModuleType) > > > > + @staticmethod > > def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj): > > GuidXRefFileName =3D os.path.join(GenFdsGlobalVariable.FvDir, = "Guid.xref") > > GuidXRefFile =3D BytesIO('') > > @@ -607,7 +607,6 @@ class GenFds : > > GuidDict =3D {} > > ModuleList =3D [] > > FileGuidList =3D [] > > - GuidPattern =3D gGuidPattern > > for Arch in ArchList: > > PlatformDataBase =3D BuildDb.BuildObject[GenFdsGlobalVaria= ble.ActivePlatform, Arch, > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] > > PkgList =3D GenFdsGlobalVariable.WorkSpace.GetPackageList(= GenFdsGlobalVariable.ActivePlatform, Arch, > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag) > > @@ -626,20 +625,16 @@ class GenFds : > > continue > > else: > > ModuleList.append(Module) > > - GuidMatch =3D GuidPattern.match(ModuleFile.BaseName) > > - if GuidMatch is not None: > > + if GlobalData.gGuidPattern.match(ModuleFile.BaseName): > > GuidXRefFile.write("%s %s\n" % (ModuleFile.BaseNam= e, Module.BaseName)) > > else: > > GuidXRefFile.write("%s %s\n" % (Module.Guid, Modul= e.BaseName)) > > - for key, item in Module.Protocols.items(): > > - GuidDict[key] =3D item > > - for key, item in Module.Guids.items(): > > - GuidDict[key] =3D item > > - for key, item in Module.Ppis.items(): > > - GuidDict[key] =3D item > > + GuidDict.update(Module.Protocols) > > + GuidDict.update(Module.Guids) > > + GuidDict.update(Module.Ppis) > > for FvName in FdfParserObj.Profile.FvDict: > > for FfsObj in FdfParserObj.Profile.FvDict[FvName].FfsL= ist: > > - if not isinstance(FfsObj, FfsFileStatement.FileSta= tement): > > + if not isinstance(FfsObj, FileStatement): > > InfPath =3D PathClass(NormPath(mws.join(GenFds= GlobalVariable.WorkSpaceDir, FfsObj.InfFileName))) > > FdfModule =3D BuildDb.BuildObject[InfPath, Arc= h, GenFdsGlobalVariable.TargetName, > GenFdsGlobalVariable.ToolChainTag] > > if FdfModule in ModuleList: > > @@ -647,12 +642,9 @@ class GenFds : > > else: > > ModuleList.append(FdfModule) > > GuidXRefFile.write("%s %s\n" % (FdfModule.Guid= , FdfModule.BaseName)) > > - for key, item in FdfModule.Protocols.items(): > > - GuidDict[key] =3D item > > - for key, item in FdfModule.Guids.items(): > > - GuidDict[key] =3D item > > - for key, item in FdfModule.Ppis.items(): > > - GuidDict[key] =3D item > > + GuidDict.update(FdfModule.Protocols) > > + GuidDict.update(FdfModule.Guids) > > + GuidDict.update(FdfModule.Ppis) > > else: > > FileStatementGuid =3D FfsObj.NameGuid > > if FileStatementGuid in FileGuidList: > > @@ -661,13 +653,13 @@ class GenFds : > > FileGuidList.append(FileStatementGuid) > > Name =3D [] > > FfsPath =3D os.path.join(GenFdsGlobalVariable.= FvDir, 'Ffs') > > - FfsPath =3D glob.glob(os.path.join(FfsPath, Fi= leStatementGuid) + '*') > > + FfsPath =3D glob(os.path.join(FfsPath, FileSta= tementGuid) + '*') > > if not FfsPath: > > continue > > if not os.path.exists(FfsPath[0]): > > continue > > MatchDict =3D {} > > - ReFileEnds =3D > re.compile('\S+(.ui)$|\S+(fv.sec.txt)$|\S+(.pe32.txt)$|\S+(.te.txt)$|\S+(= .pic.txt)$|\S+(.raw.txt)$|\S+(.ffs.txt)$') > > + ReFileEnds =3D > compile('\S+(.ui)$|\S+(fv.sec.txt)$|\S+(.pe32.txt)$|\S+(.te.txt)$|\S+(.pi= c.txt)$|\S+(.raw.txt)$|\S+(.ffs.txt)$') > > FileList =3D os.listdir(FfsPath[0]) > > for File in FileList: > > Match =3D ReFileEnds.search(File) > > @@ -724,16 +716,10 @@ class GenFds : > > os.remove(GuidXRefFileName) > > GuidXRefFile.close() > > > > - ##Define GenFd as static function > > - GenFd =3D staticmethod(GenFd) > > - GetFvBlockSize =3D staticmethod(GetFvBlockSize) > > - DisplayFvSpaceInfo =3D staticmethod(DisplayFvSpaceInfo) > > - PreprocessImage =3D staticmethod(PreprocessImage) > > - GenerateGuidXRefFile =3D staticmethod(GenerateGuidXRefFile) > > - > > if __name__ =3D=3D '__main__': > > r =3D main() > > ## 0-127 is a safe return range, and 1 is a standard default error > > - if r < 0 or r > 127: r =3D 1 > > - sys.exit(r) > > + if r < 0 or r > 127: > > + r =3D 1 > > + exit(r) > > > > diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/B= aseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > index 14578a92a9b1..e867693d7c88 100644 > > --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > @@ -16,13 +16,15 @@ > > # Import Modules > > # > > from __future__ import print_function > > +from __future__ import absolute_import > > + > > import Common.LongFilePathOs as os > > -import sys > > -import subprocess > > -import struct > > -import array > > +from sys import stdout > > +from subprocess import PIPE,Popen > > +from struct import Struct > > +from array import array > > > > -from Common.BuildToolError import * > > +from Common.BuildToolError import COMMAND_FAILURE,GENFDS_ERROR > > from Common import EdkLogger > > from Common.Misc import SaveFileOnChange > > > > @@ -89,7 +91,7 @@ class GenFdsGlobalVariable: > > EFI_FIRMWARE_FILE_SYSTEM3_GUID =3D '5473C07A-3DCB-4dca-BD6F-1E9689= E7349A' > > LARGE_FILE_SIZE =3D 0x1000000 > > > > - SectionHeader =3D struct.Struct("3B 1B") > > + SectionHeader =3D Struct("3B 1B") > > > > # FvName, FdName, CapName in FDF, Image file name > > ImageBinDict =3D {} > > @@ -97,7 +99,7 @@ class GenFdsGlobalVariable: > > ## LoadBuildRule > > # > > @staticmethod > > - def __LoadBuildRule(): > > + def _LoadBuildRule(): > > if GenFdsGlobalVariable.__BuildRuleDatabase: > > return GenFdsGlobalVariable.__BuildRuleDatabase > > BuildConfigurationFile =3D os.path.normpath(os.path.join(GenFd= sGlobalVariable.ConfDir, "target.txt")) > > @@ -139,44 +141,43 @@ class GenFdsGlobalVariable: > > if not Arch in GenFdsGlobalVariable.OutputDirDict: > > return {} > > > > - BuildRuleDatabase =3D GenFdsGlobalVariable.__LoadBuildRule() > > + BuildRuleDatabase =3D GenFdsGlobalVariable._LoadBuildRule() > > if not BuildRuleDatabase: > > return {} > > > > PathClassObj =3D PathClass(Inf.MetaFile.File, > > GenFdsGlobalVariable.WorkSpaceDir) > > - Macro =3D {} > > - Macro["WORKSPACE" ] =3D GenFdsGlobalVariable.WorkS= paceDir > > - Macro["MODULE_NAME" ] =3D Inf.BaseName > > - Macro["MODULE_GUID" ] =3D Inf.Guid > > - Macro["MODULE_VERSION" ] =3D Inf.Version > > - Macro["MODULE_TYPE" ] =3D Inf.ModuleType > > - Macro["MODULE_FILE" ] =3D str(PathClassObj) > > - Macro["MODULE_FILE_BASE_NAME" ] =3D PathClassObj.BaseName > > - Macro["MODULE_RELATIVE_DIR" ] =3D PathClassObj.SubDir > > - Macro["MODULE_DIR" ] =3D PathClassObj.SubDir > > - > > - Macro["BASE_NAME" ] =3D Inf.BaseName > > - > > - Macro["ARCH" ] =3D Arch > > - Macro["TOOLCHAIN" ] =3D GenFdsGlobalVariable.ToolC= hainTag > > - Macro["TOOLCHAIN_TAG" ] =3D GenFdsGlobalVariable.ToolC= hainTag > > - Macro["TOOL_CHAIN_TAG" ] =3D GenFdsGlobalVariable.ToolC= hainTag > > - Macro["TARGET" ] =3D GenFdsGlobalVariable.Targe= tName > > - > > - Macro["BUILD_DIR" ] =3D GenFdsGlobalVariable.Outpu= tDirDict[Arch] > > - Macro["BIN_DIR" ] =3D os.path.join(GenFdsGlobalV= ariable.OutputDirDict[Arch], Arch) > > - Macro["LIB_DIR" ] =3D os.path.join(GenFdsGlobalV= ariable.OutputDirDict[Arch], Arch) > > BuildDir =3D os.path.join( > > GenFdsGlobalVariable.OutputDirDict[Arch], > > Arch, > > PathClassObj.SubDir, > > PathClassObj.BaseName > > ) > > - Macro["MODULE_BUILD_DIR" ] =3D BuildDir > > - Macro["OUTPUT_DIR" ] =3D os.path.join(BuildDir, "OU= TPUT") > > - Macro["DEBUG_DIR" ] =3D os.path.join(BuildDir, "DE= BUG") > > - > > + BinDir =3D os.path.join(GenFdsGlobalVariable.OutputDirDict[Arc= h], Arch) > > + Macro =3D { > > + "WORKSPACE":GenFdsGlobalVariable.WorkSpaceDir, > > + "MODULE_NAME":Inf.BaseName, > > + "MODULE_GUID":Inf.Guid, > > + "MODULE_VERSION":Inf.Version, > > + "MODULE_TYPE":Inf.ModuleType, > > + "MODULE_FILE":str(PathClassObj), > > + "MODULE_FILE_BASE_NAME":PathClassObj.BaseName, > > + "MODULE_RELATIVE_DIR":PathClassObj.SubDir, > > + "MODULE_DIR":PathClassObj.SubDir, > > + "BASE_NAME":Inf.BaseName, > > + "ARCH":Arch, > > + "TOOLCHAIN":GenFdsGlobalVariable.ToolChainTag, > > + "TOOLCHAIN_TAG":GenFdsGlobalVariable.ToolChainTag, > > + "TOOL_CHAIN_TAG":GenFdsGlobalVariable.ToolChainTag, > > + "TARGET":GenFdsGlobalVariable.TargetName, > > + "BUILD_DIR":GenFdsGlobalVariable.OutputDirDict[Arch], > > + "BIN_DIR":BinDir, > > + "LIB_DIR":BinDir, > > + "MODULE_BUILD_DIR":BuildDir, > > + "OUTPUT_DIR":os.path.join(BuildDir, "OUTPUT"), > > + "DEBUG_DIR":os.path.join(BuildDir, "DEBUG") > > + } > > + > > BuildRules =3D {} > > for Type in BuildRuleDatabase.FileTypeList: > > #first try getting build rule by BuildRuleFamily > > @@ -216,12 +217,12 @@ class GenFdsGlobalVariable: > > > > if not Inf.IsBinaryModule: > > for File in Inf.Sources: > > - if File.TagName in ("", "*", GenFdsGlobalVariable.Tool= ChainTag) and \ > > - File.ToolChainFamily in ("", "*", GenFdsGlobalVari= able.ToolChainFamily): > > + if File.TagName in {"", "*", GenFdsGlobalVariable.Tool= ChainTag} and \ > > + File.ToolChainFamily in {"", "*", GenFdsGlobalVari= able.ToolChainFamily}: > > FileList.append((File, DataType.TAB_UNKNOWN_FILE)) > > > > for File in Inf.Binaries: > > - if File.Target in [DataType.TAB_COMMON, '*', GenFdsGlobalV= ariable.TargetName]: > > + if File.Target in {DataType.TAB_COMMON, '*', GenFdsGlobalV= ariable.TargetName}: > > FileList.append((File, File.Type)) > > > > for File, FileType in FileList: > > @@ -233,7 +234,7 @@ class GenFdsGlobalVariable: > > Source =3D SourceList[Index] > > Index =3D Index + 1 > > > > - if File.IsBinary and File =3D=3D Source and Inf.Binari= es is not None and File in Inf.Binaries: > > + if File.IsBinary and File =3D=3D Source and Inf.Binari= es and File in Inf.Binaries: > > # Skip all files that are not binary libraries > > if not Inf.LibraryClass: > > continue > > @@ -287,19 +288,18 @@ class GenFdsGlobalVariable: > > # @param Workspace The directory of workspace > > # @param ArchList The Arch list of platform > > # > > + @staticmethod > > def SetDir (OutputDir, FdfParser, WorkSpace, ArchList): > > - GenFdsGlobalVariable.VerboseLogger("GenFdsGlobalVariable.Outpu= tDir :%s" % OutputDir) > > -# GenFdsGlobalVariable.OutputDirDict =3D OutputDir > > + GenFdsGlobalVariable.VerboseLogger("GenFdsGlobalVariable.Outpu= tDir:%s" % OutputDir) > > GenFdsGlobalVariable.FdfParser =3D FdfParser > > GenFdsGlobalVariable.WorkSpace =3D WorkSpace > > GenFdsGlobalVariable.FvDir =3D os.path.join(GenFdsGlobalVariab= le.OutputDirDict[ArchList[0]], > DataType.TAB_FV_DIRECTORY) > > - if not os.path.exists(GenFdsGlobalVariable.FvDir) : > > + if not os.path.exists(GenFdsGlobalVariable.FvDir): > > os.makedirs(GenFdsGlobalVariable.FvDir) > > GenFdsGlobalVariable.FfsDir =3D os.path.join(GenFdsGlobalVaria= ble.FvDir, 'Ffs') > > - if not os.path.exists(GenFdsGlobalVariable.FfsDir) : > > + if not os.path.exists(GenFdsGlobalVariable.FfsDir): > > os.makedirs(GenFdsGlobalVariable.FfsDir) > > > > - T_CHAR_LF =3D '\n' > > # > > # Create FV Address inf file > > # > > @@ -308,7 +308,7 @@ class GenFdsGlobalVariable: > > # > > # Add [Options] > > # > > - FvAddressFile.writelines("[options]" + T_CHAR_LF) > > + FvAddressFile.writelines("[options]" + DataType.TAB_LINE_BREAK= ) > > BsAddress =3D '0' > > for Arch in ArchList: > > if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobal= Variable.ActivePlatform, Arch, > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBas= eAddress: > > @@ -317,19 +317,22 @@ class GenFdsGlobalVariable: > > > > FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS =3D " += \ > > BsAddress + \ > > - T_CHAR_LF) > > + DataType.TAB_LINE_BREAK) > > > > RtAddress =3D '0' > > - for Arch in ArchList: > > - if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobal= Variable.ActivePlatform, Arch, > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBas= eAddress: > > - RtAddress =3D GenFdsGlobalVariable.WorkSpace.BuildObje= ct[GenFdsGlobalVariable.ActivePlatform, Arch, > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBas= eAddress > > + for Arch in reversed(ArchList): > > + temp =3D GenFdsGlobalVariable.WorkSpace.BuildObject[GenFds= GlobalVariable.ActivePlatform, Arch, > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBas= eAddress > > + if temp: > > + RtAddress =3D temp > > + break > > > > FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS =3D = " + \ > > RtAddress + \ > > - T_CHAR_LF) > > + DataType.TAB_LINE_BREAK) > > > > FvAddressFile.close() > > > > + @staticmethod > > def SetEnv(FdfParser, WorkSpace, ArchList, GlobalData): > > GenFdsGlobalVariable.ModuleFile =3D WorkSpace.ModuleFile > > GenFdsGlobalVariable.FdfParser =3D FdfParser > > @@ -360,7 +363,6 @@ class GenFdsGlobalVariable: > > if not os.path.exists(GenFdsGlobalVariable.FfsDir): > > os.makedirs(GenFdsGlobalVariable.FfsDir) > > > > - T_CHAR_LF =3D '\n' > > # > > # Create FV Address inf file > > # > > @@ -369,7 +371,7 @@ class GenFdsGlobalVariable: > > # > > # Add [Options] > > # > > - FvAddressFile.writelines("[options]" + T_CHAR_LF) > > + FvAddressFile.writelines("[options]" + DataType.TAB_LINE_BREAK= ) > > BsAddress =3D '0' > > for Arch in ArchList: > > BsAddress =3D GenFdsGlobalVariable.WorkSpace.BuildObject[G= enFdsGlobalVariable.ActivePlatform, Arch, > > @@ -380,20 +382,20 @@ class GenFdsGlobalVariable: > > > > FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS =3D " += \ > > BsAddress + \ > > - T_CHAR_LF) > > + DataType.TAB_LINE_BREAK) > > > > RtAddress =3D '0' > > - for Arch in ArchList: > > - if GenFdsGlobalVariable.WorkSpace.BuildObject[ > > + for Arch in reversed(ArchList): > > + temp =3D GenFdsGlobalVariable.WorkSpace.BuildObject[ > > GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.= gGlobalDefines['TARGET'], > > - GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBaseAdd= ress: > > - RtAddress =3D GenFdsGlobalVariable.WorkSpace.BuildObje= ct[ > > - GenFdsGlobalVariable.ActivePlatform, Arch, GlobalD= ata.gGlobalDefines['TARGET'], > > - GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBas= eAddress > > + GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBaseAdd= ress > > + if temp: > > + RtAddress =3D temp > > + break > > > > FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS =3D = " + \ > > RtAddress + \ > > - T_CHAR_LF) > > + DataType.TAB_LINE_BREAK) > > > > FvAddressFile.close() > > > > @@ -401,6 +403,7 @@ class GenFdsGlobalVariable: > > # > > # @param String String that may contain macro > > # > > + @staticmethod > > def ReplaceWorkspaceMacro(String): > > String =3D mws.handleWsMacro(String) > > Str =3D String.replace('$(WORKSPACE)', GenFdsGlobalVariable.Wo= rkSpaceDir) > > @@ -424,7 +427,7 @@ class GenFdsGlobalVariable: > > if not os.path.exists(Output): > > return True > > # always update "Output" if no "Input" given > > - if Input is None or len(Input) =3D=3D 0: > > + if not Input: > > return True > > > > # if fdf file is changed after the 'Output" is generated, upda= te the 'Output' > > @@ -449,9 +452,9 @@ class GenFdsGlobalVariable: > > Cmd +=3D ("-s", Type) > > if CompressionType: > > Cmd +=3D ("-c", CompressionType) > > - if Guid is not None: > > + if Guid: > > Cmd +=3D ("-g", Guid) > > - if DummyFile is not None: > > + if DummyFile: > > Cmd +=3D ("--dummy", DummyFile) > > if GuidHdrLen: > > Cmd +=3D ("-l", GuidHdrLen) > > @@ -473,7 +476,7 @@ class GenFdsGlobalVariable: > > if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.S= ecCmdList: > > GenFdsGlobalVariable.SecCmdList.append(' '.join(Cm= d).strip()) > > else: > > - SectionData =3D array.array('B', [0, 0, 0, 0]) > > + SectionData =3D array('B', [0, 0, 0, 0]) > > SectionData.fromstring(Ui.encode("utf_16_le")) > > SectionData.append(0) > > SectionData.append(0) > > @@ -571,9 +574,9 @@ class GenFdsGlobalVariable: > > if BaseAddress: > > Cmd +=3D ("-r", BaseAddress) > > > > - if ForceRebase =3D=3D False: > > + if not ForceRebase: > > Cmd +=3D ("-F", "FALSE") > > - elif ForceRebase =3D=3D True: > > + else: > > Cmd +=3D ("-F", "TRUE") > > > > if Capsule: > > @@ -634,7 +637,7 @@ class GenFdsGlobalVariable: > > Revision=3DNone, DeviceId=3DNone, VendorId=3DN= one, IsMakefile=3DFalse): > > InputList =3D [] > > Cmd =3D ["EfiRom"] > > - if len(EfiInput) > 0: > > + if EfiInput: > > > > if Compress: > > Cmd.append("-ec") > > @@ -645,7 +648,7 @@ class GenFdsGlobalVariable: > > Cmd.append(EfiFile) > > InputList.append (EfiFile) > > > > - if len(BinaryInput) > 0: > > + if BinaryInput: > > Cmd.append("-b") > > for BinFile in BinaryInput: > > Cmd.append(BinFile) > > @@ -656,13 +659,13 @@ class GenFdsGlobalVariable: > > return > > GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs = update because of newer %s" % (Output, InputList)) > > > > - if ClassCode is not None: > > + if ClassCode: > > Cmd +=3D ("-l", ClassCode) > > - if Revision is not None: > > + if Revision: > > Cmd +=3D ("-r", Revision) > > - if DeviceId is not None: > > + if DeviceId: > > Cmd +=3D ("-i", DeviceId) > > - if VendorId is not None: > > + if VendorId: > > Cmd +=3D ("-f", VendorId) > > > > Cmd +=3D ("-o", Output) > > @@ -688,6 +691,7 @@ class GenFdsGlobalVariable: > > else: > > GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call= " + ToolPath, returnValue) > > > > + @staticmethod > > def CallExternalTool (cmd, errorMess, returnValue=3D[]): > > > > if type(cmd) not in (tuple, list): > > @@ -701,19 +705,19 @@ class GenFdsGlobalVariable: > > cmd +=3D ('-v',) > > GenFdsGlobalVariable.InfLogger (cmd) > > else: > > - sys.stdout.write ('#') > > - sys.stdout.flush() > > + stdout.write ('#') > > + stdout.flush() > > GenFdsGlobalVariable.SharpCounter =3D GenFdsGlobalVariable= .SharpCounter + 1 > > if GenFdsGlobalVariable.SharpCounter % GenFdsGlobalVariabl= e.SharpNumberPerLine =3D=3D 0: > > - sys.stdout.write('\n') > > + stdout.write('\n') > > > > try: > > - PopenObject =3D subprocess.Popen(' '.join(cmd), stdout=3Ds= ubprocess.PIPE, stderr=3Dsubprocess.PIPE, shell=3DTrue) > > + PopenObject =3D Popen(' '.join(cmd), stdout=3DPIPE, stderr= =3DPIPE, shell=3DTrue) > > except Exception as X: > > EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData=3D"%s= : %s" % (str(X), cmd[0])) > > (out, error) =3D PopenObject.communicate() > > > > - while PopenObject.returncode is None : > > + while PopenObject.returncode is None: > > PopenObject.wait() > > if returnValue !=3D [] and returnValue[0] !=3D 0: > > #get command return value > > @@ -727,45 +731,52 @@ class GenFdsGlobalVariable: > > print("###", cmd) > > EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess) > > > > + @staticmethod > > def VerboseLogger (msg): > > EdkLogger.verbose(msg) > > > > + @staticmethod > > def InfLogger (msg): > > EdkLogger.info(msg) > > > > + @staticmethod > > def ErrorLogger (msg, File=3DNone, Line=3DNone, ExtraData=3DNone): > > EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, Extra= Data) > > > > + @staticmethod > > def DebugLogger (Level, msg): > > EdkLogger.debug(Level, msg) > > > > - ## ReplaceWorkspaceMacro() > > + ## MacroExtend() > > # > > # @param Str String that may contain macro > > # @param MacroDict Dictionary that contains macro value pai= r > > # > > + @staticmethod > > def MacroExtend (Str, MacroDict=3D{}, Arch=3DDataType.TAB_COMMON): > > - if Str is None : > > + if Str is None: > > return None > > > > - Dict =3D {'$(WORKSPACE)' : GenFdsGlobalVariable.WorkSpaceDir= , > > - '$(EDK_SOURCE)' : GenFdsGlobalVariable.EdkSourceDir, > > + Dict =3D {'$(WORKSPACE)': GenFdsGlobalVariable.WorkSpaceDir, > > + '$(EDK_SOURCE)': GenFdsGlobalVariable.EdkSourceDir, > > # '$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputDir= FromDsc, > > - '$(TARGET)' : GenFdsGlobalVariable.TargetName, > > - '$(TOOL_CHAIN_TAG)' : GenFdsGlobalVariable.ToolChainTa= g, > > - '$(SPACE)' : ' ' > > + '$(TARGET)': GenFdsGlobalVariable.TargetName, > > + '$(TOOL_CHAIN_TAG)': GenFdsGlobalVariable.ToolChainTag= , > > + '$(SPACE)': ' ' > > } > > - OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[GenFds= GlobalVariable.ArchList[0]] > > + > > if Arch !=3D DataType.TAB_COMMON and Arch in GenFdsGlobalVaria= ble.ArchList: > > OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[Ar= ch] > > + else: > > + OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[Ge= nFdsGlobalVariable.ArchList[0]] > > > > Dict['$(OUTPUT_DIRECTORY)'] =3D OutputDir > > > > - if MacroDict is not None and len (MacroDict) !=3D 0: > > + if MacroDict: > > Dict.update(MacroDict) > > > > for key in Dict: > > - if Str.find(key) >=3D 0 : > > + if Str.find(key) >=3D 0: > > Str =3D Str.replace (key, Dict[key]) > > > > if Str.find('$(ARCH)') >=3D 0: > > @@ -780,14 +791,14 @@ class GenFdsGlobalVariable: > > # > > # @param PcdPattern pattern that labels a PCD. > > # > > + @staticmethod > > def GetPcdValue (PcdPattern): > > - if PcdPattern is None : > > + if PcdPattern is None: > > return None > > PcdPair =3D PcdPattern.lstrip('PCD(').rstrip(')').strip().spli= t('.') > > TokenSpace =3D PcdPair[0] > > TokenCName =3D PcdPair[1] > > > > - PcdValue =3D '' > > for Arch in GenFdsGlobalVariable.ArchList: > > Platform =3D GenFdsGlobalVariable.WorkSpace.BuildObject[Ge= nFdsGlobalVariable.ActivePlatform, Arch, > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] > > PcdDict =3D Platform.Pcds > > @@ -799,8 +810,7 @@ class GenFdsGlobalVariable: > > if PcdObj.DatumType !=3D DataType.TAB_VOID: > > EdkLogger.error("GenFds", GENFDS_ERROR, "%s is= not VOID* datum type." % PcdPattern) > > > > - PcdValue =3D PcdObj.DefaultValue > > - return PcdValue > > + return PcdObj.DefaultValue > > > > for Package in GenFdsGlobalVariable.WorkSpace.GetPackageLi= st(GenFdsGlobalVariable.ActivePlatform, > > = Arch, > > @@ -815,21 +825,9 @@ class GenFdsGlobalVariable: > > if PcdObj.DatumType !=3D DataType.TAB_VOID: > > EdkLogger.error("GenFds", GENFDS_ERROR, "%= s is not VOID* datum type." % PcdPattern) > > > > - PcdValue =3D PcdObj.DefaultValue > > - return PcdValue > > + return PcdObj.DefaultValue > > > > - return PcdValue > > - > > - SetDir =3D staticmethod(SetDir) > > - SetEnv =3D staticmethod(SetEnv) > > - ReplaceWorkspaceMacro =3D staticmethod(ReplaceWorkspaceMacro) > > - CallExternalTool =3D staticmethod(CallExternalTool) > > - VerboseLogger =3D staticmethod(VerboseLogger) > > - InfLogger =3D staticmethod(InfLogger) > > - ErrorLogger =3D staticmethod(ErrorLogger) > > - DebugLogger =3D staticmethod(DebugLogger) > > - MacroExtend =3D staticmethod (MacroExtend) > > - GetPcdValue =3D staticmethod(GetPcdValue) > > + return '' > > > > ## FindExtendTool() > > # > > @@ -863,7 +861,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, = NameGuid): > > ToolOptionKey =3D None > > KeyList =3D None > > for ToolDef in ToolDefinition.items(): > > - if NameGuid.lower() =3D=3D ToolDef[1].lower() : > > + if NameGuid.lower() =3D=3D ToolDef[1].lower(): > > KeyList =3D ToolDef[0].split('_') > > Key =3D KeyList[0] + \ > > '_' + \ > > diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/= Source/Python/GenFds/GuidSection.py > > index fd660737f421..25609e6f2ae1 100644 > > --- a/BaseTools/Source/Python/GenFds/GuidSection.py > > +++ b/BaseTools/Source/Python/GenFds/GuidSection.py > > @@ -19,7 +19,7 @@ > > from __future__ import absolute_import > > from . import Section > > import subprocess > > -from .Ffs import Ffs > > +from .Ffs import SectionSuffix > > import Common.LongFilePathOs as os > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > from .GenFdsGlobalVariable import FindExtendTool > > @@ -126,7 +126,7 @@ class GuidSection(GuidSectionClassObject) : > > ModuleName + \ > > SUP_MODULE_SEC + \ > > SecNum + \ > > - Ffs.SectionSuffix['GUIDED'] > > + SectionSuffix['GUIDED'] > > OutputFile =3D os.path.normpath(OutputFile) > > > > ExternalTool =3D None > > diff --git a/BaseTools/Source/Python/GenFds/OptionRom.py b/BaseTools/So= urce/Python/GenFds/OptionRom.py > > index bb7071fa7fca..9d7ad25ecc43 100644 > > --- a/BaseTools/Source/Python/GenFds/OptionRom.py > > +++ b/BaseTools/Source/Python/GenFds/OptionRom.py > > @@ -26,8 +26,6 @@ from Common.Misc import SaveFileOnChange > > from Common import EdkLogger > > from Common.BuildToolError import * > > > > -T_CHAR_LF =3D '\n' > > - > > ## > > # > > # > > @@ -36,9 +34,9 @@ class OPTIONROM (OptionRomClassObject): > > # > > # @param self The object pointer > > # > > - def __init__(self): > > + def __init__(self, Name =3D ""): > > OptionRomClassObject.__init__(self) > > - > > + self.DriverName =3D Name > > > > ## AddToBuffer() > > # > > diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Sourc= e/Python/GenFds/Region.py > > index 5242b74c9e70..9aeaa45d4566 100644 > > --- a/BaseTools/Source/Python/GenFds/Region.py > > +++ b/BaseTools/Source/Python/GenFds/Region.py > > @@ -20,7 +20,6 @@ from struct import * > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > from io import BytesIO > > import string > > -from CommonDataClass.FdfClass import RegionClassObject > > import Common.LongFilePathOs as os > > from stat import * > > from Common import EdkLogger > > @@ -32,15 +31,20 @@ from Common.DataType import BINARY_FILE_TYPE_FV > > ## generate Region > > # > > # > > -class Region(RegionClassObject): > > +class Region(object): > > > > ## The constructor > > # > > # @param self The object pointer > > # > > def __init__(self): > > - RegionClassObject.__init__(self) > > - > > + self.Offset =3D None # The begin position of the Region > > + self.Size =3D None # The Size of the Region > > + self.PcdOffset =3D None > > + self.PcdSize =3D None > > + self.SetVarDict =3D {} > > + self.RegionType =3D None > > + self.RegionDataList =3D [] > > > > ## PadBuffer() > > # > > diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/So= urce/Python/GenFds/UiSection.py > > index 24f2f3ca938d..c1dff188be96 100644 > > --- a/BaseTools/Source/Python/GenFds/UiSection.py > > +++ b/BaseTools/Source/Python/GenFds/UiSection.py > > @@ -17,7 +17,7 @@ > > # > > from __future__ import absolute_import > > from . import Section > > -from .Ffs import Ffs > > +from .Ffs import SectionSuffix > > import subprocess > > import Common.LongFilePathOs as os > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > @@ -59,7 +59,7 @@ class UiSection (UiSectionClassObject): > > self.StringData =3D FfsInf.__ExtendMacro__(self.StringData= ) > > self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) > > > > - OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODUL= E_SEC + SecNum + > Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI)) > > + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODUL= E_SEC + SecNum + > SectionSuffix.get(BINARY_FILE_TYPE_UI)) > > > > if self.StringData is not None : > > NameString =3D self.StringData > > diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/S= ource/Python/GenFds/VerSection.py > > index db71fe9653d4..051743f10c21 100644 > > --- a/BaseTools/Source/Python/GenFds/VerSection.py > > +++ b/BaseTools/Source/Python/GenFds/VerSection.py > > @@ -1,7 +1,7 @@ > > ## @file > > # process Version section generation > > # > > -# 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 t= he BSD License > > @@ -16,10 +16,8 @@ > > # Import Modules > > # > > from __future__ import absolute_import > > -from .Ffs import Ffs > > -from . import Section > > +from .Ffs import SectionSuffix > > import Common.LongFilePathOs as os > > -import subprocess > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > from CommonDataClass.FdfClass import VerSectionClassObject > > from Common.LongFilePathSupport import OpenLongFilePath as open > > @@ -54,29 +52,27 @@ class VerSection (VerSectionClassObject): > > # > > # Prepare the parameter of GenSection > > # > > - if FfsInf is not None: > > + if FfsInf: > > self.Alignment =3D FfsInf.__ExtendMacro__(self.Alignment) > > self.BuildNum =3D FfsInf.__ExtendMacro__(self.BuildNum) > > self.StringData =3D FfsInf.__ExtendMacro__(self.StringData= ) > > self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) > > > > OutputFile =3D os.path.join(OutputPath, > > - ModuleName + SUP_MODULE_SEC + SecNum= + Ffs.SectionSuffix.get('VERSION')) > > + ModuleName + SUP_MODULE_SEC + SecNum= + SectionSuffix.get('VERSION')) > > OutputFile =3D os.path.normpath(OutputFile) > > > > # Get String Data > > StringData =3D '' > > - if self.StringData is not None: > > + if self.StringData: > > StringData =3D self.StringData > > - elif self.FileName is not None: > > + elif self.FileName: > > FileNameStr =3D GenFdsGlobalVariable.ReplaceWorkspaceMacro= (self.FileName) > > FileNameStr =3D GenFdsGlobalVariable.MacroExtend(FileNameS= tr, Dict) > > FileObj =3D open(FileNameStr, 'r') > > StringData =3D FileObj.read() > > StringData =3D '"' + StringData + '"' > > FileObj.close() > > - else: > > - StringData =3D '' > > GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECT= ION_VERSION', > > Ver=3DStringData, BuildNu= mber=3Dself.BuildNum, IsMakefile=3DIsMakefile) > > OutputFileList =3D [] > > diff --git a/BaseTools/Source/Python/GenFds/Vtf.py b/BaseTools/Source/P= ython/GenFds/Vtf.py > > index 5cb2d4acfb1c..9dcd48b2d812 100644 > > --- a/BaseTools/Source/Python/GenFds/Vtf.py > > +++ b/BaseTools/Source/Python/GenFds/Vtf.py > > @@ -18,21 +18,24 @@ > > from __future__ import absolute_import > > from .GenFdsGlobalVariable import GenFdsGlobalVariable > > import Common.LongFilePathOs as os > > -from CommonDataClass.FdfClass import VtfClassObject > > from Common.LongFilePathSupport import OpenLongFilePath as open > > -T_CHAR_LF =3D '\n' > > +from Common.DataType import TAB_LINE_BREAK > > > > ## generate VTF > > # > > # > > -class Vtf (VtfClassObject): > > +class Vtf (object): > > > > ## The constructor > > # > > # @param self The object pointer > > # > > def __init__(self): > > - VtfClassObject.__init__(self) > > + self.KeyArch =3D None > > + self.ArchList =3D None > > + self.UiName =3D None > > + self.ResetBin =3D None > > + self.ComponentStatementList =3D [] > > > > ## GenVtf() method > > # > > @@ -44,7 +47,6 @@ class Vtf (VtfClassObject): > > # > > def GenVtf(self, FdAddressDict) : > > self.GenBsfInf() > > - OutputFile =3D os.path.join(GenFdsGlobalVariable.FvDir, self.U= iName + '.Vtf') > > BaseAddArg =3D self.GetBaseAddressArg(FdAddressDict) > > OutputArg, VtfRawDict =3D self.GenOutputArg() > > > > @@ -69,57 +71,57 @@ class Vtf (VtfClassObject): > > FvList =3D self.GetFvList() > > self.BsfInfName =3D os.path.join(GenFdsGlobalVariable.FvDir, s= elf.UiName + '.inf') > > BsfInf =3D open(self.BsfInfName, 'w+') > > - if self.ResetBin is not None: > > - BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF) > > + if self.ResetBin: > > + BsfInf.writelines ("[OPTIONS]" + TAB_LINE_BREAK) > > BsfInf.writelines ("IA32_RST_BIN" + \ > > " =3D " + \ > > > GenFdsGlobalVariable.MacroExtend(GenFdsGlobalVariable.ReplaceWorkspaceMac= ro(self.ResetBin)) + \ > > - T_CHAR_LF) > > - BsfInf.writelines (T_CHAR_LF) > > + TAB_LINE_BREAK) > > + BsfInf.writelines (TAB_LINE_BREAK) > > > > - BsfInf.writelines ("[COMPONENTS]" + T_CHAR_LF) > > + BsfInf.writelines ("[COMPONENTS]" + TAB_LINE_BREAK) > > > > for ComponentObj in self.ComponentStatementList : > > BsfInf.writelines ("COMP_NAME" + \ > > " =3D " + \ > > ComponentObj.CompName + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > if ComponentObj.CompLoc.upper() =3D=3D 'NONE': > > BsfInf.writelines ("COMP_LOC" + \ > > " =3D " + \ > > 'N' + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > > > - elif ComponentObj.FilePos is not None: > > + elif ComponentObj.FilePos: > > BsfInf.writelines ("COMP_LOC" + \ > > " =3D " + \ > > ComponentObj.FilePos + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > else: > > Index =3D FvList.index(ComponentObj.CompLoc.upper()) > > if Index =3D=3D 0: > > BsfInf.writelines ("COMP_LOC" + \ > > " =3D " + \ > > 'F' + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > elif Index =3D=3D 1: > > BsfInf.writelines ("COMP_LOC" + \ > > " =3D " + \ > > 'S' + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > > > BsfInf.writelines ("COMP_TYPE" + \ > > " =3D " + \ > > ComponentObj.CompType + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > BsfInf.writelines ("COMP_VER" + \ > > " =3D " + \ > > ComponentObj.CompVer + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > BsfInf.writelines ("COMP_CS" + \ > > " =3D " + \ > > ComponentObj.CompCs + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > > > BinPath =3D ComponentObj.CompBin > > if BinPath !=3D '-': > > @@ -127,7 +129,7 @@ class Vtf (VtfClassObject): > > BsfInf.writelines ("COMP_BIN" + \ > > " =3D " + \ > > BinPath + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > > > SymPath =3D ComponentObj.CompSym > > if SymPath !=3D '-': > > @@ -135,12 +137,12 @@ class Vtf (VtfClassObject): > > BsfInf.writelines ("COMP_SYM" + \ > > " =3D " + \ > > SymPath + \ > > - T_CHAR_LF) > > + TAB_LINE_BREAK) > > BsfInf.writelines ("COMP_SIZE" + \ > > " =3D " + \ > > ComponentObj.CompSize + \ > > - T_CHAR_LF) > > - BsfInf.writelines (T_CHAR_LF) > > + TAB_LINE_BREAK) > > + BsfInf.writelines (TAB_LINE_BREAK) > > > > BsfInf.close() > > > > diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/S= ource/Python/build/BuildReport.py > > index a66adfb16746..95863fefe151 100644 > > --- a/BaseTools/Source/Python/build/BuildReport.py > > +++ b/BaseTools/Source/Python/build/BuildReport.py > > @@ -46,6 +46,7 @@ from Common.StringUtils import NormPath > > from Common.DataType import * > > import collections > > from Common.Expression import * > > +from GenFds.AprioriSection import DXE_APRIORI_GUID, PEI_APRIORI_GUID > > > > ## Pattern to extract contents in EDK DXS files > > gDxsDependencyPattern =3D re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_= END", re.DOTALL) > > @@ -1853,8 +1854,8 @@ class FdRegionReport(object): > > # > > # Add PEI and DXE a priori files GUIDs defined in PI specifica= tion. > > # > > - self._GuidsDb["1B45CC0A-156A-428A-AF62-49864DA0E6E6"] =3D "PEI= Apriori" > > - self._GuidsDb["FC510EE7-FFDC-11D4-BD41-0080C73C8881"] =3D "DXE= Apriori" > > + self._GuidsDb[PEI_APRIORI_GUID] =3D "PEI Apriori" > > + self._GuidsDb[DXE_APRIORI_GUID] =3D "DXE Apriori" > > # > > # Add ACPI table storage file > > # > > -- > > 2.16.2.windows.1 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > >