From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 A27BD2117B57A for ; Thu, 25 Oct 2018 23:28:05 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2018 23:28:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,426,1534834800"; d="scan'208";a="81053318" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga007.fm.intel.com with ESMTP; 25 Oct 2018 23:28:04 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 Oct 2018 23:28:04 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 Oct 2018 23:28:02 -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 14:27:54 +0800 From: "Gao, Liming" To: "Gao, Liming" , 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/CAABGY8A== Date: Fri, 26 Oct 2018 06:27:53 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E35F146@SHSMSX104.ccr.corp.intel.com> References: <7064a2912d4507d29b00208fe7adb6a90b321e63.1540315635.git.jaben.carsey@intel.com> <20181026045359.GA18048@GaryWorkstation> <4A89E2EF3DFEDB4C8BFDE51014F606A14E35EFC0@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E35EFC0@SHSMSX104.ccr.corp.intel.com> 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 06:28:06 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Edk2 599bb2be1f2b119dcde9e5a7515dc6f3d19eb29d has fixed this issue. Please = try.=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ga= o, Liming > Sent: Friday, October 26, 2018 1:25 PM > To: Gary Lin ; Carsey, Jaben > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] [Patch v3 1/6] BaseTools/GenFds: cleanup GenFds >=20 > 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 > > > > 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, > > > > I found OVMF crashed immediately at starting up after applying this pat= ch :-\ > > > > =3D=3D > > > > $ qemu-system-x86_64 -s -enable-kvm -smp 1 -m 1024 \ > > -drive if=3Dpflash,format=3Draw,readonly,file=3D/home/gary/git/edk2/B= uild/OvmfX64/DEBUG_GCC5/FV/OVMF_CODE.fd \ > > -drive if=3Dpflash,format=3Draw,file=3D/home/gary/git/edk2/Build/Ovmf= X64/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= =3D0x402 \ > > -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 RD= X=3D0000000000000200 > > RSI=3D000000000081f698 RDI=3D000000000081fd20 RBP=3D000000000081f698 RS= P=3D000000000081f4a8 > > R8 =3D000000000081f4d8 R9 =3D000000000081f748 R10=3D0000000000000010 R1= 1=3D0000000000900000 > > R12=3D0000000000000000 R13=3D0000000000820000 R14=3D000000000081fd01 R1= 5=3D000000000081fd01 > > RIP=3D000000000009ffff RFL=3D00010807 [-O---PC] CPL=3D0 II=3D0 A20=3D1 = SMM=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=3D0000= 0660 > > DR0=3D0000000000000000 DR1=3D0000000000000000 DR2=3D0000000000000000 DR= 3=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>= 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 00 > > > > =3D=3D > > > > And, there is only one line in debug.log: > > > > SecCoreStartupWithStack(0xFFFCC000, 0x820000) > > > > Without "-enable-kvm", the error became: > > > > =3D=3D > > > > (qemu) qemu-system-x86_64: Trying to execute code outside RAM or ROM at= 0x00000000000a0000 > > This usually means one of the following happened: > > > > (1) You told QEMU to execute a kernel for the wrong machine type, and i= t 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 exe= cuted 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 > > > > This is almost always one of the first two, so check your command line = and 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= with 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. > > > > Execution cannot continue; stopping here. > > > > =3D=3D > > > > Gary Lin > > > > > 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/Ba= seTools/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 Regio= n > > > - 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/Sourc= e/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%= 02X" > > > -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[= Index + 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[= Index + 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()) + ' ' += Depex._OPCODE_STRING_[Item].lower() + ' ' + > > str(DepexStack.pop()))) > > > + DepexList.append(str(DepexList.pop()) + ' ' + Depex.= _OPCODE_STRING_[Item].upper() + ' ' + > str(DepexList.pop())) > > > + elif Item =3D=3D 0x05: > > > + DepexStack.append(eval(Depex._OPCODE_STRING_[Item].l= ower() + ' ' + 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.UnDispatche= dFfsDict.pop(FfsSecCoreGuid) > > > + self.LoadPpi(Db, FfsSecCoreGuid) > > > + > > > + # Parse PEI first > > > + if FfsPeiCoreGuid is not None: > > > + self.OrderedFfsDict[FfsPeiCoreGuid] =3D self.UnDispatche= dFfsDict.pop(FfsPeiCoreGuid) > > > + self.LoadPpi(Db, FfsPeiCoreGuid) > > > + if FfsPeiPrioriGuid is not None: > > > + # Load PEIM described in priori file > > > + FfsPeiPriori =3D self.UnDispatchedFfsDict.pop(FfsPei= PrioriGuid) > > > + 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[= Start : Start + 16]) > > > + GuidString =3D gGuidStringFormat % Guid > > > + Start =3D Start + 16 > > > + if GuidString in self.UnDispatchedFfsDic= t: > > > + self.OrderedFfsDict[GuidString] =3D = self.UnDispatchedFfsDict.pop(GuidString) > > > + self.LoadPpi(Db, GuidString) > > > + > > > + self.DisPatchPei(Db) > > > + > > > + # Parse DXE then > > > + if FfsDxeCoreGuid is not None: > > > + self.OrderedFfsDict[FfsDxeCoreGuid] =3D self.UnDispatche= dFfsDict.pop(FfsDxeCoreGuid) > > > + self.LoadProtocol(Db, FfsDxeCoreGuid) > > > + if FfsDxePrioriGuid is not None: > > > + # Load PEIM described in priori file > > > + FfsDxePriori =3D self.UnDispatchedFfsDict.pop(FfsDxe= PrioriGuid) > > > + 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[= Start : Start + 16]) > > > + GuidString =3D gGuidStringFormat % Guid > > > + Start =3D Start + 16 > > > + if GuidString in self.UnDispatchedFfsDic= t: > > > + self.OrderedFfsDict[GuidString] =3D = self.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 BelongsTo= File =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 M= oduleGuid > > > + else: > > > + EotGlobalData.gProtocolList[Record[0].lower()] =3D M= oduleGuid > > > + > > > + 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 'Pro= duced'""" \ > > > + % (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 se= lf.ParseDepex(Section._SubImages[4], 'Protocol') > > > + break > > > + if Section.Type =3D=3D 0x01: > > > + CompressSections =3D Section._SubImages[4] > > > + for CompressSection in CompressSections.Sect= ions: > > > + if CompressSection.Type =3D=3D 0x13: > > > + IsFoundDepex =3D True > > > + CouldBeLoaded, DepexString, FileDepe= x =3D self.ParseDepex(CompressSection._SubImages[4], > > 'Protocol') > > > + break > > > + if CompressSection.Type =3D=3D 0x02: > > > + NewSections =3D CompressSection._Sub= Images[4] > > > + for NewSection in NewSections.Sectio= ns: > > > + if NewSection.Type =3D=3D 0x13: > > > + IsFoundDepex =3D True > > > + CouldBeLoaded, DepexString, = FileDepex =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, New= Ffs, FileDepex[0]) > > > + else: > > > + ScheduleList[FfsID] =3D NewFfs > > > + else: > > > + self.UnDispatchedFfsDict[FfsID].Depex =3D DepexS= tring > > > + > > > + 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 BelongsT= oFile 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 se= lf.ParseDepex(Section._SubImages[4], 'Ppi') > > > + break > > > + if Section.Type =3D=3D 0x01: > > > + CompressSections =3D Section._SubImages[4] > > > + for CompressSection in CompressSections.Sect= ions: > > > + if CompressSection.Type =3D=3D 0x1B: > > > + CouldBeLoaded, DepexString, FileDepe= x =3D self.ParseDepex(CompressSection._SubImages[4], > > 'Ppi') > > > + break > > > + if CompressSection.Type =3D=3D 0x02: > > > + NewSections =3D CompressSection._Sub= Images[4] > > > + for NewSection in NewSections.Sectio= ns: > > > + if NewSection.Type =3D=3D 0x1B: > > > + CouldBeLoaded, DepexString, = FileDepex =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 DepexS= tring > > > + > > > + 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= self.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(= FfsObj) =3D=3D 0): > > > + if LastFfsObj is not None: > > > + LastFfsObj.FreeSpace =3D EndOfFv - LastFfsObj._O= FF_ - 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, sel= f.FfsDict[FfsId].Offset)) > > > + self.FfsDict[FfsId] =3D FfsObj > > > + if LastFfsObj is not None: > > > + LastFfsObj.FreeSpace =3D FfsStartAddress - LastF= fsObj._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= address > > > + # > > > + 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/BaseT= ools/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.Wor= kSpaceDir, \ > > > 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(Inf= FileName, Dict, Arch) > > > > > > - if Arch is not None: > > > + if Arch: > > > Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObje= ct[PathClass(InfFileName, > > GenFdsGlobalVariable.WorkSpaceDir), Arch, GenFdsGlobalVariable.TargetNa= me, GenFdsGlobalVariable.ToolChainTag] > > > Guid =3D Inf.Guid > > > - > > > else: > > > Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObje= ct[PathClass(InfFileName, > > GenFdsGlobalVariable.WorkSpaceDir), TAB_COMMON, GenFdsGlobalVariable.Ta= rgetName, GenFdsGlobalVariable.ToolChainTag] > > > Guid =3D Inf.Guid > > > > > > - self.BinFileList =3D Inf.Module.Binaries > > > - if self.BinFileList =3D=3D []: > > > - EdkLogger.error("GenFds", RESOURCE_NOT_AVAIL= ABLE, > > > + if not Inf.Module.Binaries: > > > + EdkLoggerError("GenFds", RESOURCE_NOT_AVAILA= BLE, > > > "INF %s not found in build A= RCH %s!" \ > > > % (InfFileName, GenFdsGlobal= Variable.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', = AprioriFileGuid, MakefilePath=3DMakefilePath) > > > > > > return AprFfsFileName > > > - > > > diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/So= urce/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, FindExtendTo= ol > > > 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-347= d375665a7}') > > > EFI_CERT_TYPE_RSA2048_SHA256_GUID =3D uuid.UUID('{a7717414-c616-4977= -9420-844712a735bf}') > > > @@ -39,7 +35,7 @@ EFI_CERT_TYPE_RSA2048_SHA256_GUID =3D uuid.UUID('{a= 7717414-c616-4977-9420-844712a7 > > > ## create inf file describes what goes into capsule and call GenFv t= o 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(),= False) > > > CapInfFile.close() > > > # > > > @@ -249,13 +245,13 @@ class Capsule (CapsuleClassObject) : > > > self.UiCapsuleName + "_Cap" + '.= inf') > > > 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/BaseTool= s/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/Base= Tools/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, I= nputAlign=3DSectAlign, IsMakefile=3DIsMakefile) > > > diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTool= s/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_MO= DULE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType)) > > > + OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MO= DULE_SEC + SecNum + SectionSuffix.get(self.SecType)) > > > OutputFile =3D os.path.normpath(OutputFile) > > > GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectF= ileName], Section.Section.SectionType.get(self.SecType), > > IsMakefile =3D IsMakefile) > > > FileList =3D [OutputFile] > > > diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseToo= ls/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): > > > = GenFdsGlobalVariable.TargetName, > > > = GenFdsGlobalVariable.ToolChainTag) > > > for Inf in GenFdsGlobalVariable.FdfParser.Profile.InfLis= t: > > > - ModuleFile =3D PathClass(Inf, GenFdsGlobalVariable.W= orkSpaceDir) > > > ModuleData =3D GenFdsGlobalVariable.WorkSpace.BuildO= bject[ > > > - ModuleFi= le, > > > + PathClas= s(Inf, GenFdsGlobalVariable.WorkSpaceDir), > > > Arch, > > > GenFdsGl= obalVariable.TargetName, > > > GenFdsGl= obalVariable.ToolChainTag > > > diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools= /Source/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, ModuleNa= me + SUP_MODULE_SEC + Num + > > Ffs.SectionSuffix.get(SectionType)) > > > + OutputFile =3D os.path.join(OutputPath, ModuleNa= me + 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, "Fil= e: %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, ModuleNa= me + SUP_MODULE_SEC + Num + > > Ffs.SectionSuffix.get(SectionType)) > > > + OutputFile =3D os.path.join(OutputPath, ModuleNa= me + 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, ModuleN= ame + SUP_MODULE_SEC + Num + > > Ffs.SectionSuffix.get(SectionType)) > > > + OutputFile =3D os.path.join( OutputPath, ModuleN= ame + SUP_MODULE_SEC + Num + > > SectionSuffix.get(SectionType)) > > > File =3D GenFdsGlobalVariable.MacroExtend(File, = Dict) > > > > > > #Get PE Section alignment when align is set to A= UTO > > > diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/= Source/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= _SHA256_GUID, Capsule > > > +from .CapsuleData import CapsuleFfs, CapsulePayload, CapsuleFv, Caps= uleFd, 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= _SLASH, \ > > > -T_CHAR_BACKSLASH, T_CHAR_DOUBLE_QUOTE, T_CHAR_SINGLE_QUOTE, T_CHAR_S= TAR, 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_= CHAIN_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_CHA= IN_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 parsi= ng 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_BREA= K > > > except: > > > EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraDat= a=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, ExtraDat= a=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("WORKSPA= CE") > > > > > > - ## __SkipWhiteSpace() method > > > + ## _SkipWhiteSpace() method > > > # > > > - # Skip white spaces from current char, return number of chars = skipped > > > + # 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_CH= AR_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,= TAB_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 = end > > > # @retval False Current File buffer position is NOT at f= ile 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.Curr= entOffsetWithinLine >=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 = end > > > # @retval False Current File buffer position is NOT at l= ine end > > > # > > > - def __EndOfLine(self): > > > + def _EndOfLine(self): > > > if self.CurrentLineNumber > len(self.Profile.FileLinesList): > > > return True > > > SizeOfCurrentLine =3D len(self.Profile.FileLinesList[self.Cu= rrentLineNumber - 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 beg= inning reached > > > # > > > - def __UndoOneChar(self): > > > - > > > + def _UndoOneChar(self): > > > if self.CurrentLineNumber =3D=3D 1 and self.CurrentOffsetWit= hinLine =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.File= LinesList[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= pointer > > > # > > > # @param self The object pointer > > > # @retval Char Next char > > > # > > > - def __NextChar(self): > > > + def _NextChar(self): > > > if self.CurrentOffsetWithinLine =3D=3D len(self.Profile.File= LinesList[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.= CurrentOffsetWithinLine] =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.Profil= e.FileLinesList] > > > if not self.Profile.FileLinesList: > > > EdkLogger.error('FdfParser', FILE_READ_FAILURE, 'The fil= e 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 Valu= e > > > 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= _CHAR_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= .CurrentLineNumber) > > > - 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.__CurSect= ion[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], sel= f.__CurSection[1], self.__CurSection[2]] > > > + MacroDict =3D self._MacroDict[self._CurSection[0], self.= _CurSection[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= allowed in this section > > > # [VTF.arch.UiName, arch] > > > # [OptionRom.DriverName] > > > - self.__CurSection =3D [] > > > - Section =3D Section.strip()[1:-1].upper().replace(' ', '').s= trip('.') > > > - ItemList =3D Section.split('.') > > > + self._CurSection =3D [] > > > + Section =3D Section.strip()[1:-1].upper().replace(' ', '').s= trip(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_COMMO= N] > > > + 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_COM= MON] > > > + self._CurSection =3D [ItemList[0], ItemList[1], TAB_COMM= ON] > > > 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 n= ot InComment: > > > + if self._CurrentChar() =3D=3D T_CHAR_DOUBLE_QUOTE and no= t 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 HashCo= mment 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 HashCo= mment 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._= _NextChar() =3D=3D T_CHAR_SLASH and not self.__EndOfLine(): > > > + elif self._CurrentChar() =3D=3D TAB_BACK_SLASH and self.= _NextChar() =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 sel= f.__EndOfLine() and not InString: > > > + elif self._CurrentChar() =3D=3D TAB_COMMENT_SPLIT and no= t 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._= _NextChar() =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.= _NextChar() =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 se= lf.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.FileNa= me, 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, s= elf.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= (TAB_INCLUDE) > > > + if not self._GetNextToken(): > > > raise Warning("expected include file name", self= .FileName, 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 InsertAtLin= e + 1 > > > # deal with remaining portions after "!include filen= ame", if exists. > > > - if self.__GetNextToken(): > > > + if self._GetNextToken(): > > > if self.CurrentLineNumber =3D=3D CurrentLine: > > > - RemainingLine =3D self.__CurrentLine()[Curre= ntOffset:] > > > + RemainingLine =3D self._CurrentLine()[Curren= tOffset:] > > > self.Profile.FileLinesList.insert(self.Curre= ntLineNumber, 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[Include= Line - 1]) > > > - TempList.insert(IncludeOffset, '#') > > > + TempList.insert(IncludeOffset, TAB_COMMENT_SPLIT) > > > self.Profile.FileLinesList[IncludeLine - 1] =3D ''.j= oin(TempList) > > > if Processed: # Nested and back-to-back support > > > self.Rewind(DestLine =3D IncFileProfile.InsertStartL= ineNumber - 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 macr= o > > > - 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 secti= on header", self.FileName, self.CurrentLineNumber) > > > - self.__SectionHeaderParser(Header) > > > + self._SectionHeaderParser(Header) > > > continue > > > # Replace macros except in RULE section or out of se= ction > > > - elif self.__CurSection and ReplacedLine !=3D self.Cu= rrentLineNumber: > > > + elif self._CurSection and ReplacedLine !=3D self.Cur= rentLineNumber: > > > ReplacedLine =3D self.CurrentLineNumber > > > - self.__UndoToken() > > > + self._UndoToken() > > > CurLine =3D self.Profile.FileLinesList[ReplacedL= ine - 1] > > > PreIndex =3D 0 > > > StartPos =3D CurLine.find('$(', PreIndex) > > > EndPos =3D CurLine.find(')', StartPos+2) > > > - while StartPos !=3D -1 and EndPos !=3D -1 and se= lf.__Token not in ['!ifdef', '!ifndef', '!if', '!elseif']: > > > - MacroName =3D CurLine[StartPos+2 : EndPos] > > > - MacorValue =3D self.__GetMacroValue(MacroNam= e) > > > + while StartPos !=3D -1 and EndPos !=3D -1 and se= lf._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('$(' + Macro= Name + ')', MacorValue, 1) > > > if MacorValue.find('$(') !=3D -1: > > > @@ -771,74 +723,74 @@ class FdfParser: > > > self.Profile.FileLinesList[ReplacedLine - 1] =3D= CurLine > > > 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 Ru= le section or out of section", self.FileName, > > self.CurrentLineNumber) > > > DefineLine =3D self.CurrentLineNumber - 1 > > > - DefineOffset =3D self.CurrentOffsetWithinLine - = len('DEFINE') > > > - if not self.__GetNextToken(): > > > + DefineOffset =3D self.CurrentOffsetWithinLine - = len(TAB_DEFINE) > > > + if not self._GetNextToken(): > > > raise Warning("expected Macro name", self.Fi= leName, 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.FileNam= e, self.CurrentLineNumber) > > > > > > - Value =3D self.__GetExpression() > > > - self.__SetMacroValue(Macro, Value) > > > - self.__WipeOffArea.append(((DefineLine, DefineOf= fset), (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, DefineOff= set), (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('SE= T') > > > - 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, s= elf.CurrentLineNumber) > > > > > > - Value =3D self.__GetExpression() > > > - Value =3D self.__EvaluateConditional(Value, self.Cur= rentLineNumber, 'eval', True) > > > + Value =3D self._GetExpression() > > > + Value =3D self._EvaluateConditional(Value, self.Curr= entLineNumber, '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, sel= f.CurrentLineNumber) > > > self.Profile.PcdFileLineDict[PcdPair] =3D FileLineTu= ple > > > > > > - self.__WipeOffArea.append(((SetLine, SetOffset), (se= lf.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - > 1))) > > > - elif self.__Token in ('!ifdef', '!ifndef', '!if'): > > > - IfStartPos =3D (self.CurrentLineNumber - 1, self.Cur= rentOffsetWithinLine - len(self.__Token)) > > > + self._WipeOffArea.append(((SetLine, SetOffset), (sel= f.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > + elif self._Token in (TAB_IF_DEF, TAB_IF_N_DEF, TAB_IF): > > > + IfStartPos =3D (self.CurrentLineNumber - 1, self.Cur= rentOffsetWithinLine - 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.__EvaluateConditiona= l(Expression, IfList[-1][0][0] + 1, 'eval') > > > + if CondLabel =3D=3D TAB_IF: > > > + ConditionSatisfied =3D self._EvaluateConditional= (Expression, IfList[-1][0][0] + 1, 'eval') > > > else: > > > - ConditionSatisfied =3D self.__EvaluateConditiona= l(Expression, IfList[-1][0][0] + 1, 'in') > > > - if CondLabel =3D=3D '!ifndef': > > > + ConditionSatisfied =3D self._EvaluateConditional= (Expression, IfList[-1][0][0] + 1, 'in') > > > + if CondLabel =3D=3D TAB_IF_N_DEF: > > > ConditionSatisfied =3D not ConditionSatisfie= d > > > > > > BranchDetermined =3D ConditionSatisfied > > > IfList[-1] =3D [IfList[-1][0], ConditionSatisfied, B= ranchDetermined] > > > if ConditionSatisfied: > > > - self.__WipeOffArea.append((IfList[-1][0], (self.= CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > - elif self.__Token in ('!elseif', '!else'): > > > - ElseStartPos =3D (self.CurrentLineNumber - 1, self.C= urrentOffsetWithinLine - len(self.__Token)) > > > + self._WipeOffArea.append((IfList[-1][0], (self.C= urrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > + elif self._Token in (TAB_ELSE_IF, '!else'): > > > + ElseStartPos =3D (self.CurrentLineNumber - 1, self.C= urrentOffsetWithinLine - len(self._Token)) > > > if len(IfList) <=3D 0: > > > raise Warning("Missing !if statement", self.File= Name, self.CurrentLineNumber) > > > > > > if IfList[-1][1]: > > > IfList[-1] =3D [ElseStartPos, False, True] > > > - self.__WipeOffArea.append((ElseStartPos, (self.C= urrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > + self._WipeOffArea.append((ElseStartPos, (self.Cu= rrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > else: > > > - self.__WipeOffArea.append((IfList[-1][0], ElseSt= artPos)) > > > + self._WipeOffArea.append((IfList[-1][0], ElseSta= rtPos)) > > > IfList[-1] =3D [ElseStartPos, True, IfList[-1][2= ]] > > > - if self.__Token =3D=3D '!elseif': > > > - Expression =3D self.__GetExpression() > > > - ConditionSatisfied =3D self.__EvaluateCondit= ional(Expression, IfList[-1][0][0] + 1, 'eval') > > > + if self._Token =3D=3D TAB_ELSE_IF: > > > + Expression =3D self._GetExpression() > > > + ConditionSatisfied =3D self._EvaluateConditi= onal(Expression, IfList[-1][0][0] + 1, 'eval') > > > IfList[-1] =3D [IfList[-1][0], ConditionSati= sfied, 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.File= Name, self.CurrentLineNumber) > > > if IfList[-1][1]: > > > - self.__WipeOffArea.append(((self.CurrentLineNumb= er - 1, self.CurrentOffsetWithinLine - len('!endif')), > > (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > + self._WipeOffArea.append(((self.CurrentLineNumbe= r - 1, self.CurrentOffsetWithinLine - len('!endif')), > > (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > else: > > > - self.__WipeOffArea.append((IfList[-1][0], (self.= CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > + self._WipeOffArea.append((IfList[-1][0], (self.C= urrentLineNumber - 1, self.CurrentOffsetWithinLine - 1))) > > > > > > IfList.pop() > > > elif not IfList: # Don't use PCDs inside conditional = directive > > > @@ -862,7 +814,7 @@ class FdfParser: > > > continue > > > SetPcd =3D ShortcutPcdPattern.match(self.Profile.Fil= eLinesList[self.CurrentLineNumber - 1]) > > > if SetPcd: > > > - self.__PcdDict[SetPcd.group('name')] =3D SetPcd.= group('value') > > > + self._PcdDict[SetPcd.group('name')] =3D SetPcd.g= roup('value') > > > RegionLayoutLine =3D self.CurrentLineNumber > > > continue > > > RegionSize =3D RegionSizePattern.match(self.Profile.= FileLinesList[self.CurrentLineNumber - 1]) > > > @@ -873,35 +825,35 @@ class FdfParser: > > > if not RegionSizeGuid: > > > RegionLayoutLine =3D self.CurrentLineNumber + 1 > > > continue > > > - self.__PcdDict[RegionSizeGuid.group('base')] =3D Reg= ionSize.group('base') > > > - self.__PcdDict[RegionSizeGuid.group('size')] =3D Reg= ionSize.group('size') > > > + self._PcdDict[RegionSizeGuid.group('base')] =3D Regi= onSize.group('base') > > > + self._PcdDict[RegionSizeGuid.group('size')] =3D Regi= onSize.group('size') > > > RegionLayoutLine =3D self.CurrentLineNumber + 1 > > > > > > if IfList: > > > raise Warning("Missing !endif", self.FileName, self.Curr= entLineNumber) > > > 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, = TAB_COMMON] > > > + ScopeMacro =3D self._MacroDict[TAB_COMMON, TAB_COMMON, T= AB_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, V= alue =3D None): > > > - MacroPcdDict =3D self.__CollectMacroPcd() > > > + def _EvaluateConditional(self, Expression, Line, Op =3D None, Va= lue =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 evaluati= on result > > > # > > > EdkLogger.warn('Parser', "Suspicious expression: %s"= % str(Excpt), > > > - File=3Dself.FileName, ExtraData=3Dse= lf.__CurrentLine(), > > > + File=3Dself.FileName, ExtraData=3Dse= lf._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 positi= on 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 po= inter moved forward > > > # @retval False Not able to find string, file buffer poi= nter 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.CurrentOffsetWithinL= ine : ].upper().find(String.upper()) > > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLi= ne: ].upper().find(String.upper()) > > > else: > > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithinL= ine : ].find(String) > > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLi= ne: ].find(String) > > > if index =3D=3D 0: > > > self.CurrentOffsetWithinLine +=3D len(String) > > > - self.__Token =3D self.__CurrentLine()[StartPos : self.Cu= rrentOffsetWithinLine] > > > + self._Token =3D self._CurrentLine()[StartPos: self.Curre= ntOffsetWithinLine] > > > return True > > > return False > > > > > > - ## __IsKeyword() method > > > + ## _IsKeyword() method > > > # > > > # Check whether input keyword is found from current char posit= ion 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 po= inter moved forward > > > # @retval False Not able to find string, file buffer poi= nter 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.CurrentOffsetWithinL= ine : ].upper().find(KeyWord.upper()) > > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLi= ne: ].upper().find(KeyWord.upper()) > > > else: > > > - index =3D self.__CurrentLine()[self.CurrentOffsetWithinL= ine : ].find(KeyWord) > > > + index =3D self._CurrentLine()[self.CurrentOffsetWithinLi= ne: ].find(KeyWord) > > > if index =3D=3D 0: > > > - followingChar =3D self.__CurrentLine()[self.CurrentOffse= tWithinLine + len(KeyWord)] > > > - if not str(followingChar).isspace() and followingChar no= t in SEPERATOR_TUPLE: > > > + followingChar =3D self._CurrentLine()[self.CurrentOffset= WithinLine + len(KeyWord)] > > > + if not str(followingChar).isspace() and followingChar no= t in SEPARATORS: > > > return False > > > self.CurrentOffsetWithinLine +=3D len(KeyWord) > > > - self.__Token =3D self.__CurrentLine()[StartPos : self.Cu= rrentOffsetWithinLine] > > > + self._Token =3D self._CurrentLine()[StartPos: self.Curre= ntOffsetWithinLine] > > > 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.Current= LineNumber - 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 = buffer pointer moved forward > > > # @retval False Not able to find a C name string, file b= uffer 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 (Tem= pChar >=3D 'A' and TempChar <=3D 'Z') \ > > > or (TempChar >=3D '0' and TempChar <=3D '9') or Temp= Char =3D=3D '_' or TempChar =3D=3D '-': > > > - self.__GetOneChar() > > > + self._GetOneChar() > > > > > > else: > > > break > > > > > > - self.__Token =3D self.__CurrentLine()[StartPos : self.Cu= rrentOffsetWithinLine] > > > + self._Token =3D self._CurrentLine()[StartPos: self.Curre= ntOffsetWithinLine] > > > 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 (Tem= pChar >=3D 'A' and TempChar <=3D 'Z') \ > > > - or (TempChar >=3D '0' and TempChar <=3D '9') or Temp= Char =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 Temp= Char =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.Cu= rrentOffsetWithinLine] > > > + self._Token =3D self._CurrentLine()[StartPos: self.Curre= ntOffsetWithinLine] > > > 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 buf= fer pointer moved forward > > > # @retval False Not able to find a token unit, file buff= er 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= non-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 i= n seperator tuple. > > > # That is, when we got a space or any char in the tuple,= we got the end of token. > > > - if not str(TempChar).isspace() and TempChar not in SEPER= ATOR_TUPLE: > > > - self.__GetOneChar() > > > + if not str(TempChar).isspace() and TempChar not in SEPAR= ATORS: > > > + self._GetOneChar() > > > # if we happen to meet a seperator as the first char, we= must proceed to get it. > > > # That is, we get a token that is a seperator char. noma= lly it is the boundary of other tokens. > > > - elif StartPos =3D=3D self.CurrentOffsetWithinLine and Te= mpChar in SEPERATOR_TUPLE: > > > - self.__GetOneChar() > > > + elif StartPos =3D=3D self.CurrentOffsetWithinLine and Te= mpChar 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][Sta= rtPos : EndPos] > > > - if self.__Token.lower() in [TAB_IF, TAB_END_IF, TAB_ELSE_IF,= TAB_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][Star= tPos: EndPos] > > > + if self._Token.lower() in [TAB_IF, TAB_END_IF, TAB_ELSE_IF, = TAB_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,= file 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 = value 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 i= n seperator tuple. > > > # That is, when we got a space or any char in the tuple,= we got the end of token. > > > - if not str(TempChar).isspace() and not TempChar in SEPER= ATOR_TUPLE: > > > - if not self.__UndoOneChar(): > > > + if not str(TempChar).isspace() and not TempChar in SEPAR= ATORS: > > > + if not self._UndoOneChar(): > > > return > > > # if we happen to meet a seperator as the first char, we= must proceed to get it. > > > # That is, we get a token that is a seperator char. noma= lly it is the boundary of other tokens. > > > - elif StartPos =3D=3D self.CurrentOffsetWithinLine and Te= mpChar in SEPERATOR_TUPLE: > > > + elif StartPos =3D=3D self.CurrentOffsetWithinLine and Te= mpChar 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 buffe= r pointer moved forward > > > # @retval False Not able to find a HEX data, file buffer= pointer 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 b= uffer pointer moved forward > > > # @retval False Not able to find a decimal data, file bu= ffer 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 .<= PcdCName>", 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 .<= PcdCName>", self.FileName, self.CurrentLineNumber) > > > > > > - if not self.__GetNextWord(): > > > + if not self._GetNextWord(): > > > raise Warning("expected format of .<= PcdCName>", 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 bu= ffer pointer moved forward > > > # @retval False Not able to find a string data, file buf= fer 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._Toke= n.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.Fi= leName, self.CurrentLineNumber) > > > if currentLineNumber !=3D self.CurrentLineNumber: > > > raise Warning("Missing Quote \" for String", self.Fi= leName, self.CurrentLineNumber) > > > - self.__Token =3D self.__SkippedChars.rstrip('\"') > > > + self._Token =3D self._SkippedChars.rstrip(T_CHAR_DOUBLE_= QUOTE) > > > return True > > > > > > - elif self.__Token.startswith("\'") or self.__Token.startswit= h("L\'"): > > > - self.__UndoToken() > > > - self.__SkipToToken("\'") > > > + elif self._Token.startswith(T_CHAR_SINGLE_QUOTE) or self._To= ken.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.Fi= leName, self.CurrentLineNumber) > > > if currentLineNumber !=3D self.CurrentLineNumber: > > > raise Warning("Missing Quote \' for String", self.Fi= leName, self.CurrentLineNumber) > > > - self.__Token =3D self.__SkippedChars.rstrip('\'') > > > + self._Token =3D self._SkippedChars.rstrip(T_CHAR_SINGLE_= QUOTE) > > > 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 buffe= r pointer moved forward > > > # @retval False Not able to find the string, file buffer= pointer 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.CurrentOffsetWit= hinLine : ].upper().find(String.upper()) > > > + index =3D self._CurrentLine()[self.CurrentOffsetWith= inLine: ].upper().find(String.upper()) > > > else: > > > - index =3D self.__CurrentLine()[self.CurrentOffsetWit= hinLine : ].find(String) > > > + index =3D self._CurrentLine()[self.CurrentOffsetWith= inLine: ].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 se= lf.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 secti= ons 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() o= r 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,= FileLineTuple[0]) + \ > > > + self._UndoToken() > > > + #'\n\tGot Token: \"%s\" from File %s\n' % (self._Token, = FileLineTuple[0]) + \ > > > # At this point, the closest parent would be the include= d file itself > > > Profile =3D GetParentAtLine(X.OriginalLineNumber) > > > if Profile is not None: > > > @@ -1386,7 +1336,7 @@ class FdfParser: > > > else: > > > FileLineTuple =3D GetRealFileLine(self.FileName, sel= f.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("[RUL= E.") and not S.startswith("[OPTIONROM.") and not > > S.startswith('[FMPPAYLOAD.'): > > > raise Warning("Unknown section or section appear sequenc= e error (The correct sequence should be [DEFINES], > [FD.], > > [FV.], [Capsule.], [VTF.], [Rule.], [OptionRom.], [FMPPAYLOAD.])", self= .FileName, self.CurrentLineNumber) > > > > > > - ## __GetDefines() method > > > + ## _GetDefines() method > > > # > > > # Get Defines section contents and store its data into AllMacr= osList > > > # > > > @@ -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("[DE= FINES"): > > > 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.Cu= rrentLineNumber) > > > #print 'Parsing String: %s in File %s, At line: %d, Offs= et Within Line: %d' \ > > > - # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > + # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > raise Warning("expected [DEFINES", self.FileName, self.C= urrentLineNumber) > > > > > > - if not self.__IsToken( "]"): > > > + if not self._IsToken(TAB_SECTION_END): > > > raise Warning("expected ']'", self.FileName, self.Curren= tLineNumber) > > > > > > - 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.= CurrentLineNumber) > > > - if not self.__GetNextToken() or self.__Token.startswith(= '['): > > > + if not self._GetNextToken() or self._Token.startswith(TA= B_SECTION_START): > > > raise Warning("expected MACRO value", self.FileName,= self.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._= _CurrentLine().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._= CurrentLine().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 dictionar= y 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('[FMPPA= YLOAD.') and not S.startswith("[CAPSULE.") \ > > > and not S.startswith("[VTF.") and not S.startswith("= [RULE.") and not S.startswith("[OPTIONROM."): > > > raise Warning("Unknown section", self.FileName, self= .CurrentLineNumber) > > > - 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.Cu= rrentLineNumber) > > > #print 'Parsing String: %s in File %s, At line: %d, Offs= et Within Line: %d' \ > > > - # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > + # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > raise Warning("expected [FD.]", self.FileName, self.Curr= entLineNumber) > > > > > > - 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.FileNa= me, self.CurrentLineNumber) > > > > > > - if not self.__IsToken( "]"): > > > + if not self._IsToken(TAB_SECTION_END): > > > raise Warning("expected ']'", self.FileName, self.Curren= tLineNumber) > > > > > > - 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.FdNameNotS= et: > > > raise Warning("expected all FDs have their name", self.F= ileName, self.CurrentLineNumber) > > > > > > - Status =3D self.__GetCreateFile(FdObj) > > > + Status =3D self._GetCreateFile(FdObj) > > > if not Status: > > > raise Warning("FD name error", self.FileName, self.Curre= ntLineNumber) > > > > > > - 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.File= Name, 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, s= elf.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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected file name", self.FileName, s= elf.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.FileNam= e,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.= CurrentLineNumber) > > > > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex base address", self.File= Name, 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 FileLineTu= ple > > > 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex size", self.FileName, se= lf.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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Erase Polarity", self.FileNa= me, 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= .FileName, 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextDecimalNumber() and not self.__GetN= extHexNumber(): > > > + if not self._GetNextDecimalNumber() and not self._GetNex= tHexNumber(): > > > raise Warning("expected address", self.FileName, sel= f.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.= CurrentLineNumber) > > > > > > - if not self.__GetNextDecimalNumber() and not self.__GetN= extHexNumber(): > > > + if not self._GetNextDecimalNumber() and not self._GetNex= tHexNumber(): > > > raise Warning("expected address", self.FileName, sel= f.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.FileN= ame, 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextHexNumber() and not self.__GetNextDecim= alNumber(): > > > + if not self._GetNextHexNumber() and not self._GetNextDecimal= Number(): > > > raise Warning("expected Hex or Integer block size", self= .FileName, 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextDecimalNumber() and not self.__GetN= extHexNumber(): > > > + if not self._GetNextDecimalNumber() and not self._GetNex= tHexNumber(): > > > raise Warning("expected block numbers", self.FileNam= e, self.CurrentLineNumber) > > > > > > - BlockNumber =3D long(self.__Token, 0) > > > + BlockNumber =3D long(self._Token, 0) > > > > > > Obj.BlockSizeList.append((BlockSize, BlockNumber, BlockSizeP= cd)) > > > 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected value", self.FileName, self.= CurrentLineNumber) > > > > > > - 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.= CurrentLineNumber) > > > > > > - Value =3D self.__GetExpression() > > > - Value =3D self.__EvaluateConditional(Value, self.Current= LineNumber, 'eval', True) > > > + Value =3D self._GetExpression() > > > + Value =3D self._EvaluateConditional(Value, self.CurrentL= ineNumber, '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.Curren= tLineNumber) > > > > > > - Size =3D self.__CalcRegionExpr() > > > + Size =3D self._CalcRegionExpr() > > > if Size is None: > > > raise Warning("expected Region Size", self.FileName, sel= f.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", = "DATA", "CAPSULE", "INF"): > > > + if not self._Token in ("SET", BINARY_FILE_TYPE_FV, "FILE", "= DATA", "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 ex= pression which starts with a PCD. > > > # PcdOffset[|PcdSize] or OffsetPcdExpression|Size > > > # > > > - self.__UndoToken() > > > - IsRegionPcd =3D (RegionSizeGuidPattern.match(self.__Curr= entLine()[self.CurrentOffsetWithinLine:]) or > > > - RegionOffsetPcdPattern.match(self.__Curre= ntLine()[self.CurrentOffsetWithinLine:])) > > > + self._UndoToken() > > > + IsRegionPcd =3D (RegionSizeGuidPattern.match(self._Curre= ntLine()[self.CurrentOffsetWithinLine:]) or > > > + RegionOffsetPcdPattern.match(self._Curren= tLine()[self.CurrentOffsetWithinLine:])) > > > if IsRegionPcd: > > > - RegionObj.PcdOffset =3D self.__GetNextPcdSettings() > > > - self.Profile.PcdDict[RegionObj.PcdOffset] =3D "0x%08= X" % (RegionObj.Offset + long(Fd.BaseAddress, 0)) > > > + RegionObj.PcdOffset =3D self._GetNextPcdSettings() > > > + self.Profile.PcdDict[RegionObj.PcdOffset] =3D "0x%08= X" % (RegionObj.Offset + long(theFd.BaseAddress, 0)) > > > self.SetPcdLocalation(RegionObj.PcdOffset) > > > - self.__PcdDict['%s.%s' % (RegionObj.PcdOffset[1], Re= gionObj.PcdOffset[0])] =3D "0x%x" % RegionObj.Offset > > > + self._PcdDict['%s.%s' % (RegionObj.PcdOffset[1], Reg= ionObj.PcdOffset[0])] =3D "0x%x" % RegionObj.Offset > > > FileLineTuple =3D GetRealFileLine(self.FileName, sel= f.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%= 08X" % RegionObj.Size > > > self.SetPcdLocalation(RegionObj.PcdSize) > > > - self.__PcdDict['%s.%s' % (RegionObj.PcdSize[1], = RegionObj.PcdSize[0])] =3D "0x%x" % RegionObj.Size > > > + self._PcdDict['%s.%s' % (RegionObj.PcdSize[1], R= egionObj.PcdSize[0])] =3D "0x%x" % RegionObj.Size > > > FileLineTuple =3D GetRealFileLine(self.FileName,= self.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, = DATA, 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", se= lf.FileName, self.CurrentLineNumber) > > > > > > - if not self.__IsToken( "=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FV name", self.FileName, self.Cu= rrentLineNumber) > > > > > > 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FV name", self.FileName, sel= f.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.FileNam= e, self.CurrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected CAPSULE name", self.FileName, se= lf.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.= CurrentLineNumber) > > > > > > - 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, = self.CurrentLineNumber) > > > > > > - if not self.__IsToken( "=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected File name", self.FileName, self.= CurrentLineNumber) > > > > > > 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FILE name", self.FileName, s= elf.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.Curr= entLineNumber) > > > > > > - if not self.__IsToken( "{"): > > > + if not self._IsToken("{"): > > > raise Warning("expected '{'", self.FileName, self.Curren= tLineNumber) > > > > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex byte", self.FileName, self.C= urrentLineNumber) > > > > > > - if len(self.__Token) > 18: > > > + if len(self._Token) > 18: > > > raise Warning("Hex string can't be converted to a valid = 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_COMM= A_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.FileNam= e, self.CurrentLineNumber) > > > - if len(self.__Token) > 4: > > > + if len(self._Token) > 4: > > > raise Warning("Hex byte(must be 2 digits) too lo= ng", 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.Curren= tLineNumber) > > > > > > - 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.= CurrentLineNumber) > > > > > > - if not self.__IsToken( "{"): > > > + if not self._IsToken("{"): > > > raise Warning("expected '{'", self.FileName, self.Cu= rrentLineNumber) > > > > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex byte", self.FileName, se= lf.CurrentLineNumber) > > > > > > - if len(self.__Token) > 18: > > > + if len(self._Token) > 18: > > > raise Warning("Hex string can't be converted to a va= lid 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[AllStrL= en - 2: AllStrLen] + "," > > > + DataString =3D DataString + "0x" + AllString[AllStrL= en - 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.Fil= eName, self.CurrentLineNumber) > > > - if len(self.__Token) > 4: > > > + if len(self._Token) > 4: > > > raise Warning("Hex byte(must be 2 digits) to= o 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.Cu= rrentLineNumber) > > > > > > - 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 dictionar= y 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.Cu= rrentLineNumber) > > > #print 'Parsing String: %s in File %s, At line: %d, Offs= et Within Line: %d' \ > > > - # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > - raise Warning("Unknown Keyword '%s'" % self.__Token, sel= f.FileName, self.CurrentLineNumber) > > > + # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > + raise Warning("Unknown Keyword '%s'" % self._Token, self= .FileName, 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.Curren= tLineNumber) > > > > > > - 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.Curre= ntLineNumber) > > > > > > - 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.__GetFvB= aseAddress(FvObj) or > > > - self.__GetFvForceRebase(FvObj) or self.__GetFvAlignm= ent(FvObj) or > > > - self.__GetFvAttributes(FvObj) or self.__GetFvNameGui= d(FvObj) or > > > - self.__GetFvExtEntryStatement(FvObj) or self.__GetFv= NameString(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)): > > > break > > > > > > if FvObj.FvNameString =3D=3D 'TRUE' and not FvObj.FvNameGuid= : > > > raise Warning("FvNameString found but FvNameGuid was not= found", 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 = FvObj.DefineVarDict.copy()) > > > + isInf =3D self._GetInfStatement(FvObj) > > > + isFile =3D self._GetFileStatement(FvObj, MacroDict =3D F= vObj.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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected alignment value", self.FileName,= self.CurrentLineNumber) > > > > > > - if self.__Token.upper() not in ("1", "2", "4", "8", "16", "3= 2", "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.__To= ken, self.FileName, self.CurrentLineNumber) > > > - Obj.FvAlignment =3D self.__Token > > > + raise Warning("Unknown alignment value '%s'" % self._Tok= en, 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 statem= ent > > > # @retval False Not able to find a FvBaseAddress stateme= nt > > > # > > > - 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FV base address value", self.Fil= eName, self.CurrentLineNumber) > > > > > > - if not BaseAddrValuePattern.match(self.__Token.upper()): > > > - raise Warning("Unknown FV base address value '%s'" % sel= f.__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'" % sel= f._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 statem= ent > > > # @retval False Not able to find a FvForceRebase stateme= nt > > > # > > > - 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FvForceRebase value", self.FileN= ame, 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", = "0X00", "1", "0X1", "0X01"]: > > > + raise Warning("Unknown FvForceRebase value '%s'" % self.= _Token, 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", "RE= AD_ENABLED_CAP", \ > > > "READ_DISABLED_CAP", "READ_STATUS", "READ= _LOCK_CAP", \ > > > "READ_LOCK_STATUS", "WRITE_LOCK_CAP", "WR= ITE_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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken() or self.__Token.upper() not= in ("TRUE", "FALSE", "1", "0"): > > > + if not self._GetNextToken() or self._Token.upper() not i= n ("TRUE", "FALSE", "1", "0"): > > > raise Warning("expected TRUE/FALSE (1/0)", self.File= Name, 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextGuid(): > > > + if not self._GetNextGuid(): > > > raise Warning("expected FV GUID value", self.FileName, s= elf.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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken() or self.__Token not in ('TRUE',= 'FALSE'): > > > + if not self._GetNextToken() or self._Token not in ('TRUE', '= FALSE'): > > > raise Warning("expected TRUE or FALSE for FvNameString",= self.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.__IsKeywor= d( "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.Cur= rentLineNumber) > > > > > > - if not self.__IsToken( "=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextHexNumber() and not self.__GetNextDecim= alNumber(): > > > + if not self._GetNextHexNumber() and not self._GetNextDecimal= Number(): > > > raise Warning("expected Hex FV extension entry type valu= e 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.Curren= tLineNumber) > > > > > > - if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("= DATA"): > > > + if not self._IsKeyword ("FILE") and not self._IsKeyword ("DA= TA"): > > > 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.= CurrentLineNumber) > > > > > > - if not self.__IsToken( "{"): > > > + if not self._IsToken("{"): > > > raise Warning("expected '{'", self.FileName, self.Cu= rrentLineNumber) > > > > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex byte", self.FileName, se= lf.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 > > > > > > - while self.__IsToken(","): > > > - if not self.__GetNextHexNumber(): > > > + while self._IsToken(TAB_COMMA_SPLIT): > > > + if not self._GetNextHexNumber(): > > > raise Warning("Invalid Hex number", self.FileNam= e, self.CurrentLineNumber) > > > - if len(self.__Token) > 4: > > > + if len(self._Token) > 4: > > > raise Warning("Hex byte(must be 2 digits) too lo= ng", 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.Cu= rrentLineNumber) > > > > > > - if not self.__IsToken( "}"): > > > + if not self._IsToken("}"): > > > raise Warning("expected '}'", self.FileName, self.Cu= rrentLineNumber) > > > > > > - 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FV Extension Entry file path= At 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.Cu= rrentLineNumber) > > > > > > 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.FileNam= e, self.CurrentLineNumber) > > > - AprType =3D self.__Token > > > + AprType =3D self._Token > > > > > > - if not self.__IsToken( "{"): > > > + if not self._IsToken("{"): > > > raise Warning("expected '{'", self.FileName, self.Curren= tLineNumber) > > > > > > - 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.Curren= tLineNumber) > > > > > > 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, s= elf.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, = self.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.InfFi= leName), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > > if ErrorCode !=3D 0: > > > @@ -2492,16 +2427,16 @@ class FdfParser: > > > else: > > > self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFil= eName) > > > > > > - 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.= CurrentLineNumber) > > > - if not self.__GetNextGuid(): > > > + if not self._GetNextGuid(): > > > raise Warning("expected GUID value", self.FileName, = self.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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Rule name", self.FileName, s= elf.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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Version", self.FileName, sel= f.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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected UI name", self.FileName, sel= f.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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected ARCH name", self.FileName, s= elf.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_= 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(","): > > > + if self._GetNextToken(): > > > + p =3D > > compile(r'([a-zA-Z0-9\-]+|\$\(TARGET\)|\*)_([a-zA-Z0-9\-]+|\$\(TOOL_CHA= IN_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_A= rch\"", 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, MacroDic= t =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.C= urrentLineNumber) > > > > > > - 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextGuid(): > > > - if not self.__GetNextWord(): > > > + if not self._GetNextGuid(): > > > + if not self._GetNextWord(): > > > raise Warning("expected File GUID", self.FileName, s= elf.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, sel= f.CurrentLineNumber) > > > - PcdPair =3D self.__GetNextPcdSettings() > > > - if not self.__IsToken( ")"): > > > + PcdPair =3D self._GetNextPcdSettings() > > > + if not self._IsToken(")"): > > > raise Warning("expected ')'", self.FileName, sel= f.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_MOD= ULE_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_PE3= 2): > > > 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.__IsKeywo= rd('RELOCS_RETAINED'): > > > - if self.__FileCouldHaveRelocFlag(FfsFileObj.FvFileTy= pe): > > > - 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.FvFileTyp= e): > > > + 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= strip flag%d" % (FfsFileObj.FvFileType, > > self.CurrentLineNumber), self.FileName, self.CurrentLineNumber) > > > > > > - if not self.__IsToken("{"): > > > + if not self._IsToken("{"): > > > raise Warning("expected '{'", self.FileName, self.Cu= rrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected File name or section data", self= .FileName, 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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FV name", self.FileName, sel= f.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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FD name", self.FileName, sel= f.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.FvFile= Type =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.Curren= tLineNumber) > > > > > > - ## __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", = "4M", "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.= _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.__GetNextToken(): > > > + if not self._Token =3D=3D "Auto": > > > + AlignValue =3D self._Token > > > + if not self._GetNextToken(): > > > raise Warning("expected Filename value", self.FileNa= me, 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.FileNa= me, self.CurrentLineNumber) > > > > > > - self.__VerifyFile(FileName) > > > + self._VerifyFile(FileName) > > > File =3D PathClass(NormPath(FileName), GenFdsGlobalVaria= ble.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 \"Targ= et_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", "= 128", "512", "1K", "4K", "32K", "64K", "128K", > > > - "256K", "512K", "1M", "2M", "4M"= , "8M", "16M"): > > > - raise Warning("Incorrect alignment '%s'" % self.__To= ken, self.FileName, self.CurrentLineNumber) > > > + if self._GetAlignment(): > > > + if self._Token not in ALIGNMENTS: > > > + raise Warning("Incorrect alignment '%s'" % self._Tok= en, 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected alignment value", self.FileN= ame, 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, sel= f.CurrentLineNumber) > > > else: > > > return False > > > > > > 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", "4M"= , "8M", "16M"): > > > - raise Warning("Incorrect alignment '%s'" % self.__To= ken, self.FileName, self.CurrentLineNumber) > > > - AlignValue =3D self.__Token > > > + if self._GetAlignment(): > > > + if self._Token not in ALIGNMENTS: > > > + raise Warning("Incorrect alignment '%s'" % self._Tok= en, 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Build number value", self.Fi= leName, 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 PE= 32 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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected version", self.FileName, sel= f.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 PE= 32 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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected UI", self.FileName, self.Cur= rentLineNumber) > > > - 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 PE= 32 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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FV name or FV file path", se= lf.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, MacroD= ict.copy()) > > > + IsInf =3D self._GetInfStatement(FvObj) > > > + IsFile =3D self._GetFileStatement(FvObj, MacroDi= ct.copy()) > > > if not IsInf and not IsFile: > > > break > > > > > > - if not self.__IsToken( "}"): > > > + if not self._IsToken("}"): > > > raise Warning("expected '}'", self.FileName, sel= f.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("= DXE_DEPEX_EXP") or self.__IsKeyword("SMM_DEPEX_EXP"): > > > + elif self._IsKeyword("PEI_DEPEX_EXP") or self._IsKeyword("DX= E_DEPEX_EXP") or self._IsKeyword("SMM_DEPEX_EXP"): > > > if AlignValue =3D=3D 'Auto': > > > raise Warning("Auto alignment can only be used in PE= 32 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.= CurrentLineNumber) > > > - if not self.__IsToken( "{"): > > > + if not self._IsToken("{"): > > > raise Warning("expected '{'", self.FileName, self.Cu= rrentLineNumber) > > > - if not self.__SkipToToken( "}"): > > > + if not self._SkipToToken("}"): > > > raise Warning("expected Depex expression ending '}'"= , self.FileName, self.CurrentLineNumber) > > > > > > - DepexSectionObj.Expression =3D self.__SkippedChars.rstri= p('}') > > > + 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 "= GUIDED": > > > self.SetFileBufferPos(OldPos) > > > return False > > > > > > - if self.__Token not in ("COMPAT16", BINARY_FILE_TYPE_PE3= 2, 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", BINAR= Y_FILE_TYPE_PEI_DEPEX, "SUBTYPE_GUID", > > BINARY_FILE_TYPE_SMM_DEPEX): > > > - raise Warning("Unknown section type '%s'" % self.__T= oken, self.FileName, self.CurrentLineNumber) > > > - if AlignValue =3D=3D 'Auto'and (not self.__Token =3D=3D = BINARY_FILE_TYPE_PE32) and (not self.__Token =3D=3D > > BINARY_FILE_TYPE_TE): > > > + raise Warning("Unknown section type '%s'" % self._To= ken, self.FileName, self.CurrentLineNumber) > > > + if AlignValue =3D=3D 'Auto'and (not self._Token =3D=3D B= INARY_FILE_TYPE_PE32) and (not self._Token =3D=3D > > BINARY_FILE_TYPE_TE): > > > raise Warning("Auto alignment can only be used in PE= 32 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.__IsKeywo= rd('RELOCS_RETAINED'): > > > - if self.__FileCouldHaveRelocFlag(Obj.FvFileType) and > self.__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 = self._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, co= uld not have reloc strip flag%d" % (Obj.FvFileType, > > DataSectionObj.SecType, self.CurrentLineNumber), self.FileName, self.Cu= rrentLineNumber) > > > > > > - 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= .FileName, 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 $(OUTP= UT_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(= "OUTPUT_DIRECTORY") in FileName: > > > + if not GlobalData.gAutoGenPhase or not self._GetMacroValue(T= AB_DSC_DEFINES_OUTPUT_DIRECTORY) in FileName: > > > ErrorCode, ErrorInfo =3D PathClass(NormPath(FileName), G= enFdsGlobalVariable.WorkSpaceDir).Validate() > > > if ErrorCode !=3D 0: > > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DErr= orInfo) > > > > > > - ## __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_NO= NE"): > > > - 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.Cu= rrentLineNumber) > > > > > > - CompressSectionObj =3D CompressSection.CompressSection() > > > + CompressSectionObj =3D CompressSection() > > > CompressSectionObj.Alignment =3D AlignValue > > > CompressSectionObj.CompType =3D type > > > # Recursive sections... > > > while True: > > > - IsLeafSection =3D self.__GetLeafSection(CompressSect= ionObj) > > > - IsEncapSection =3D self.__GetEncapsulationSec(Compre= ssSectionObj) > > > + IsLeafSection =3D self._GetLeafSection(CompressSecti= onObj) > > > + IsEncapSection =3D self._GetEncapsulationSec(Compres= sSectionObj) > > > if not IsLeafSection and not IsEncapSection: > > > break > > > > > > > > > - if not self.__IsToken( "}"): > > > + if not self._IsToken("}"): > > > raise Warning("expected '}'", self.FileName, self.Cu= rrentLineNumber) > > > 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.Cu= rrentLineNumber) > > > - 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_HEA= DER_SIZE"] > > > # Recursive sections... > > > while True: > > > - IsLeafSection =3D self.__GetLeafSection(GuidSectionO= bj) > > > - IsEncapSection =3D self.__GetEncapsulationSec(GuidSe= ctionObj) > > > + IsLeafSection =3D self._GetLeafSection(GuidSectionOb= j) > > > + IsEncapSection =3D self._GetEncapsulationSec(GuidSec= tionObj) > > > if not IsLeafSection and not IsEncapSection: > > > break > > > > > > - if not self.__IsToken( "}"): > > > + if not self._IsToken("}"): > > > raise Warning("expected '}'", self.FileName, self.Cu= rrentLineNumber) > > > 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 = attributes > > > # > > > - 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.__IsKe= yword("AUTH_STATUS_VALID") \ > > > - or self.__IsKeyword("EXTRA_HEADER_SIZE"): > > > - AttribKey =3D self.__Token > > > + while self._IsKeyword("PROCESSING_REQUIRED") or self._IsKeyw= ord("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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected TRUE(1)/FALSE(0)/Number", se= lf.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, = self.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.File= Name, 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, sel= f.CurrentLineNumber) > > > else: > > > return False > > > > > > AlignValue =3D None > > > - if self.__GetAlignment(): > > > - if self.__Token not in ("8", "16", "32", "64", "128", "5= 12", "1K", "4K", "32K", "64K", "128K", > > > - "256K", "512K", "1M", "2M", "4M"= , "8M", "16M"): > > > - raise Warning("Incorrect alignment '%s'" % self.__To= ken, self.FileName, self.CurrentLineNumber) > > > - AlignValue =3D self.__Token > > > + if self._GetAlignment(): > > > + if self._Token not in ALIGNMENT_NOAUTO: > > > + raise Warning("Incorrect alignment '%s'" % self._Tok= en, 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("[FM= PPAYLOAD."): > > > 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" % FmpUi= Name, 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.Curren= tLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("The FMP payload section is empty!", self.= FileName, 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.= CurrentLineNumber) > > > if Name =3D=3D 'IMAGE_TYPE_ID': > > > - if not self.__GetNextGuid(): > > > + if not self._GetNextGuid(): > > > raise Warning("expected GUID value for IMAGE_TYP= E_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 CERTIFICA= TE_GUID.", self.FileName, self.CurrentLineNumber) > > > - FmpData.Certificate_Guid =3D self.__Token > > > - if uuid.UUID(FmpData.Certificate_Guid) !=3D EFI_CERT= _TYPE_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= _RSA2048_SHA256_GUID and > > UUID(FmpData.Certificate_Guid) !=3D EFI_CERT_TYPE_PKCS7_GUID: > > > raise Warning("Only support EFI_CERT_TYPE_RSA204= 8_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, sel= f.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)(FmpDat= a.MonotonicCount, 16) > > > else: > > > FmpData.MonotonicCount =3D (long)(FmpDat= a.MonotonicCount) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > break > > > else: > > > - self.__UndoToken() > > > + self._UndoToken() > > > > > > if (FmpData.MonotonicCount and not FmpData.Certificate_Guid)= or (not FmpData.MonotonicCount and > > FmpData.Certificate_Guid): > > > EdkLogger.error("FdfParser", FORMAT_INVALID, "CERTIFICAT= E_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 pay= load 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= list 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("[CA= PSULE."): > > > 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.Cu= rrentLineNumber) > > > #print 'Parsing String: %s in File %s, At line: %d, Offs= et Within Line: %d' \ > > > - # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > + # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > raise Warning("expected [Capsule.]", self.FileName, self= .CurrentLineNumber) > > > > > > - 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, se= lf.CurrentLineNumber) > > > > > > CapsuleObj.UiCapsuleName =3D CapsuleName.upper() > > > > > > - if not self.__IsToken( "]"): > > > + if not self._IsToken(TAB_SECTION_END): > > > raise Warning("expected ']'", self.FileName, self.Curren= tLineNumber) > > > > > > - 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected file name", self.FileName, s= elf.CurrentLineNumber) > > > > > > - CapsuleObj.CreateFile =3D self.__Token > > > + CapsuleObj.CreateFile =3D self._Token > > > > > > - self.__GetCapsuleStatements(CapsuleObj) > > > + self._GetCapsuleStatements(CapsuleObj) > > > self.Profile.CapsuleDict[CapsuleObj.UiCapsuleName] =3D Capsu= leObj > > > 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.= CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected value", self.FileName, self.= CurrentLineNumber) > > > if Name =3D=3D 'CAPSULE_FLAGS': > > > - if not self.__Token in ("PersistAcrossReset", "Popul= ateSystemTable", "InitiateReset"): > > > + if not self._Token in ("PersistAcrossReset", "Popula= teSystemTable", "InitiateReset"): > > > raise Warning("expected PersistAcrossReset, Popu= lateSystemTable, 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.FileNam= e, self.CurrentLineNumber) > > > - if not self.__Token in ("PersistAcrossReset", "P= opulateSystemTable", "InitiateReset"): > > > + if not self._Token in ("PersistAcrossReset", "Po= pulateSystemTable", "InitiateReset"): > > > raise Warning("expected PersistAcrossReset, = PopulateSystemTable, 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= and 0xFFFF", self.FileName, self.CurrentLineNumber) > > > try: > > > @@ -3357,51 +3281,49 @@ class FdfParser: > > > raise Warning("expected hex value between 0x0000= and 0xFFFF", self.FileName, self.CurrentLineNumber) > > > if not 0x0000 <=3D Value <=3D 0xFFFF: > > > raise Warning("expected hex value between 0x0000= and 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 = IsAfile 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FV name", self.FileName, self.Cu= rrentLineNumber) > > > > > > - 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, s= elf.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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected FD name", self.FileName, self.Cu= rrentLineNumber) > > > > > > - 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, s= elf.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.Curr= entLineNumber) > > > > > > - 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" % se= lf.__Token, self.FileName, self.CurrentLineNumber) > > > + raise Warning("This FMP Payload does not exist: %s" % se= lf._Token, self.FileName, self.CurrentLineNumber) > > > CapsuleObj.FmpPayloadList.append(self.Profile.FmpPayloadDict= [Payload]) > > > 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected File name", self.FileName, self.= CurrentLineNumber) > > > > > > - 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.WorkSpaceD= ir, 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Afile name", self.FileName, self= .CurrentLineNumber) > > > > > > - 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= (AfileName) > > > - self.__VerifyFile(AfileName) > > > + self._VerifyFile(AfileName) > > > else: > > > if not os.path.exists(AfileName): > > > raise Warning('%s does not exist' % AfileName, self.= FileName, 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("[RU= LE."): > > > 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.Cu= rrentLineNumber) > > > #print 'Parsing String: %s in File %s, At line: %d, Offs= et Within Line: %d' \ > > > - # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > + # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > raise Warning("expected [Rule.]", self.FileName, self.Cu= rrentLineNumber) > > > > > > - if not self.__SkipToToken("."): > > > + if not self._SkipToToken(TAB_SPLIT): > > > raise Warning("expected '.'", self.FileName, self.Curren= tLineNumber) > > > > > > - 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,= self.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.FileNam= e, 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.Curren= tLineNumber) > > > > > > - 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, sel= f.CurrentLineNumber) > > > - if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_P= EI_CORE, SUP_MODULE_PEIM, > > SUP_MODULE_DXE_CORE, \ > > > + if self._Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PE= I_CORE, SUP_MODULE_PEIM, > > SUP_MODULE_DXE_CORE, \ > > > SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_S= AL_DRIVER, \ > > > SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_D= XE_RUNTIME_DRIVER, \ > > > - SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI= _APPLICATION, > SUP_MODULE_USER_DEFINED, > > "DEFAULT", SUP_MODULE_BASE, \ > > > + SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI= _APPLICATION, > 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_T= YPE_BS_DRIVER, > > EDK_COMPONENT_TYPE_RT_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER, EDK_COM= PONENT_TYPE_APPLICATION, > "ACPITABLE", > > SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STAND= ALONE): > > > - raise Warning("Unknown Module type '%s'" % self.__Token,= self.FileName, self.CurrentLineNumber) > > > - return self.__Token > > > + raise Warning("Unknown Module type '%s'" % self._Token, = self.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.Curren= tLineNumber) > > > > > > 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._= _Token, self.FileName, self.CurrentLineNumber) > > > + raise Warning("Unknown file extension '%s'" % self._= Token, self.FileName, self.CurrentLineNumber) > > > > > > else: > > > raise Warning("expected file extension", self.FileName, = self.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.Curre= ntLineNumber) > > > > > > - if not self.__GetNextWord(): > > > + if not self._GetNextWord(): > > > raise Warning("expected FFS type", self.FileName, self.C= urrentLineNumber) > > > > > > - Type =3D self.__Token.strip().upper() > > > + Type =3D self._Token.strip().upper() > > > if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODUL= E_PEI_CORE, SUP_MODULE_PEIM,\ > > > "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_D= XE_CORE, > > EDK_COMPONENT_TYPE_APPLICATION, "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE,= SUP_MODULE_MM_STANDALONE, > > SUP_MODULE_MM_CORE_STANDALONE): > > > - raise Warning("Unknown FV type '%s'" % self.__Token, sel= f.FileName, self.CurrentLineNumber) > > > + raise Warning("Unknown FV type '%s'" % self._Token, self= .FileName, self.CurrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - 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.FileNam= e, 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, sel= f.CurrentLineNumber) > > > - PcdPair =3D self.__GetNextPcdSettings() > > > - if not self.__IsToken( ")"): > > > + PcdPair =3D self._GetNextPcdSettings() > > > + if not self._IsToken(")"): > > > raise Warning("expected ')'", self.FileName, sel= f.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('= RELOCS_RETAINED'): > > > - if self.__FileCouldHaveRelocFlag(Type): > > > - if self.__Token =3D=3D 'RELOCS_STRIPPED': > > > + if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RE= LOCS_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 str= ip 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 \"Targ= et_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", "= 128", "512", "1K", "4K", "32K", "64K", "128K", > > > - "256K", "512K", "1M", "2M", "4M"= , "8M", "16M"): > > > - raise Warning("Incorrect alignment '%s'" % self.__To= ken, self.FileName, self.CurrentLineNumber) > > > + if self._GetAlignment(): > > > + if self._Token not in ALIGNMENTS: > > > + raise Warning("Incorrect alignment '%s'" % self._Tok= en, 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= (Rule) > > > - IsLeaf =3D self.__GetEfiSection(Rule) > > > + IsEncapsulate =3D self._GetRuleEncapsulationSection(= NewRule) > > > + 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.Cu= rrentLineNumber) > > > > > > - return Rule > > > + return NewRule > > > > > > else: > > > # Simple file rule expected > > > - if not self.__GetNextWord(): > > > + if not self._GetNextWord(): > > > raise Warning("expected leaf section type", self.Fil= eName, 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= _TYPE_PEI_DEPEX, "VERSION", "SUBTYPE_GUID", > > BINARY_FILE_TYPE_SMM_DEPEX): > > > raise Warning("Unknown leaf section name '%s'" % Sec= tionName, 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", = "4M", "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.= _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): > > > raise Warning("Auto alignment can only be used i= n 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, s= elf.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, BI= NARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > > BINARY_FILE_TYPE_UI, "VERSION", BINAR= Y_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, sel= f.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", se= lf.FileName, self.CurrentLineNumber) > > > - FvImageSectionObj.FvFileType =3D self.__Token > > > + if not self._IsKeyword(BINARY_FILE_TYPE_FV): > > > + raise Warning("expected 'FV'", self.FileName, se= lf.CurrentLineNumber) > > > + FvImageSectionObj.FvFileType =3D self._Token > > > > > > - if self.__GetAlignment(): > > > - if self.__Token not in ("8", "16", "32", "64", "= 128", "512", "1K", "4K", "32K", "64K", "128K", > > > - "256K", "512K", "1M", "2= M", "4M", "8M", "16M"): > > > - raise Warning("Incorrect alignment '%s'" % s= elf.__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'" % s= elf._Token, self.FileName, self.CurrentLineNumber) > > > + FvImageSectionObj.Alignment =3D self._Token > > > > > > - if self.__IsToken('|'): > > > - FvImageSectionObj.FvFileExtension =3D self.__Get= FileExtension() > > > - 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): > > > + FvImageSectionObj.FvFileExtension =3D self._GetF= ileExtension() > > > + elif self._GetNextToken(): > > > + if self._Token not in ("}", "COMPAT16", BINARY_F= ILE_TYPE_PE32, BINARY_FILE_TYPE_PIC, > > BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > > BINARY_FILE_TYPE_UI, "VERSION", BINAR= Y_FILE_TYPE_PEI_DEPEX, > BINARY_FILE_TYPE_GUID, > > BINARY_FILE_TYPE_SMM_DEPEX): > > > - FvImageSectionObj.FvFileName =3D self.__Toke= n > > > + FvImageSectionObj.FvFileName =3D self._Token > > > else: > > > - self.__UndoToken() > > > + self._UndoToken() > > > else: > > > raise Warning("expected FV file name", self.File= Name, 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.= CurrentLineNumber) > > > > > > - if self.__Token =3D=3D "STRING": > > > - if not self.__RuleSectionCouldHaveString(EfiSectionObj.S= ectionType): > > > + if self._Token =3D=3D "STRING": > > > + if not self._RuleSectionCouldHaveString(EfiSectionObj.Se= ctionType): > > > 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Quoted String", self.FileNam= e, 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(EfiSectio= nObj.SectionType): > > > + if self._IsKeyword("BUILD_NUM"): > > > + if not self._RuleSectionCouldHaveBuildNum(EfiSection= Obj.SectionType): > > > raise Warning("%s section could NOT have BUILD_N= UM%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, s= elf.CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Build number", self.File= Name, self.CurrentLineNumber) > > > - EfiSectionObj.BuildNum =3D self.__Token > > > + EfiSectionObj.BuildNum =3D self._Token > > > > > > else: > > > - EfiSectionObj.FileType =3D self.__Token > > > - self.__CheckRuleSectionFileType(EfiSectionObj.SectionTyp= e, EfiSectionObj.FileType) > > > + EfiSectionObj.FileType =3D self._Token > > > + self._CheckRuleSectionFileType(EfiSectionObj.SectionType= , EfiSectionObj.FileType) > > > > > > - if self.__IsKeyword("Optional"): > > > - if not self.__RuleSectionCouldBeOptional(EfiSectionObj.S= ectionType): > > > + if self._IsKeyword("Optional"): > > > + if not self._RuleSectionCouldBeOptional(EfiSectionObj.Se= ctionType): > > > 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(EfiSectio= nObj.SectionType): > > > + if self._IsKeyword("BUILD_NUM"): > > > + if not self._RuleSectionCouldHaveBuildNum(EfiSection= Obj.SectionType): > > > raise Warning("%s section could NOT have BUILD_N= UM%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, s= elf.CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Build number", self.File= Name, 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", "= 128", "512", "1K", "4K", "32K", "64K", "128K", > > > - "256K", "512K", "1M", "2M", "4M"= , "8M", "16M"): > > > - raise Warning("Incorrect alignment '%s'" % self.__To= ken, 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._Tok= en, 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 PE= 32 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('= RELOCS_RETAINED'): > > > - if self.__SectionCouldHaveRelocFlag(EfiSectionObj.Sectio= nType): > > > - if self.__Token =3D=3D 'RELOCS_STRIPPED': > > > + if self._IsKeyword('RELOCS_STRIPPED') or self._IsKeyword('RE= LOCS_RETAINED'): > > > + if self._SectionCouldHaveRelocFlag(EfiSectionObj.Section= Type): > > > + 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 = strip 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_TYP= E_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= _PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, > > "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_DEPEX,\ > > > BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_T= YPE_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.FileN= ame, self.CurrentLineNumber) > > > - PcdPair =3D self.__GetNextPcdSettings() > > > - if not self.__IsToken( ")"): > > > + PcdPair =3D self._GetNextPcdSettings() > > > + if not self._IsToken(")"): > > > raise Warning("expected ')'", self.FileN= ame, self.CurrentLineNumber) > > > - self.__Token =3D 'PCD('+PcdPair[1]+'.'+PcdPa= ir[0]+')' > > > + self._Token =3D 'PCD('+PcdPair[1]+TAB_SPLIT+= PcdPair[0]+')' > > > > > > - EfiSectionObj.FileName =3D self.__Token > > > + EfiSectionObj.FileName =3D self._Token > > > > > > else: > > > - self.__UndoToken() > > > + self._UndoToken() > > > else: > > > raise Warning("expected section file name", self.FileNam= e, 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_T= YPE_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 informat= ion > > > # > > > @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'" % F= ileType, 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'" % F= ileType, 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_NO= NE"): > > > - 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.Cu= rrentLineNumber) > > > > > > - CompressSectionObj =3D CompressSection.CompressSection() > > > + CompressSectionObj =3D CompressSection() > > > > > > CompressSectionObj.CompType =3D Type > > > # Recursive sections... > > > while True: > > > - IsEncapsulate =3D self.__GetRuleEncapsulationSection= (CompressSectionObj) > > > - IsLeaf =3D self.__GetEfiSection(CompressSectionObj) > > > + IsEncapsulate =3D self._GetRuleEncapsulationSection(= CompressSectionObj) > > > + 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.Cu= rrentLineNumber) > > > - 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.Cu= rrentLineNumber) > > > - GuidSectionObj =3D GuidSection.GuidSection() > > > + GuidSectionObj =3D GuidSection() > > > GuidSectionObj.NameGuid =3D GuidValue > > > GuidSectionObj.SectionType =3D "GUIDED" > > > GuidSectionObj.ProcessRequired =3D AttribDict["PROCESSIN= G_REQUIRED"] > > > @@ -4140,20 +4051,20 @@ class FdfParser: > > > > > > # Efi sections... > > > while True: > > > - IsEncapsulate =3D self.__GetRuleEncapsulationSection= (GuidSectionObj) > > > - IsLeaf =3D self.__GetEfiSection(GuidSectionObj) > > > + IsEncapsulate =3D self._GetRuleEncapsulationSection(= GuidSectionObj) > > > + 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.Cu= rrentLineNumber) > > > - 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= self.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("[VT= F."): > > > 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.Cu= rrentLineNumber) > > > #print 'Parsing String: %s in File %s, At line: %d, Offs= et Within Line: %d' \ > > > - # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > + # % (self.Profile.FileLinesList[self.CurrentLineN= umber - 1][self.CurrentOffsetWithinLine:], FileLineTuple[0], > > FileLineTuple[1], self.CurrentOffsetWithinLine) > > > raise Warning("expected [VTF.]", self.FileName, self.Cur= rentLineNumber) > > > > > > - if not self.__SkipToToken("."): > > > + if not self._SkipToToken(TAB_SPLIT): > > > raise Warning("expected '.'", self.FileName, self.Curren= tLineNumber) > > > > > > - 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, T= AB_ARCH_ARM, TAB_ARCH_AARCH64}: > > > raise Warning("Unknown Arch '%s'" % Arch, self.FileName,= self.CurrentLineNumber) > > > > > > - if not self.__GetNextWord(): > > > + if not self._GetNextWord(): > > > raise Warning("expected VTF name", self.FileName, self.C= urrentLineNumber) > > > - 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, s= elf.CurrentLineNumber) > > > - if self.__Token.upper() not in ("IA32", "X64", "IPF", "A= RM", "AARCH64"): > > > - raise Warning("Unknown Arch '%s'" % self.__Token, se= lf.FileName, self.CurrentLineNumber) > > > - VtfObj.ArchList =3D self.__Token.upper() > > > + if self._Token.upper() not in (TAB_ARCH_IA32, TAB_ARCH_X= 64, TAB_ARCH_IPF, TAB_ARCH_ARM, > > TAB_ARCH_AARCH64): > > > + raise Warning("Unknown Arch '%s'" % self._Token, sel= f.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.Curren= tLineNumber) > > > > > > - 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.= CurrentLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Reset file", self.FileName, = self.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.R= esetBin), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > > if ErrorCode !=3D 0: > > > EdkLogger.error("GenFds", ErrorCode, ExtraData= =3DErrorInfo) > > > > > > - 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.Curr= entLineNumber) > > > > > > - if not self.__GetNextWord(): > > > + if not self._GetNextWord(): > > > raise Warning("expected Component Name", self.FileName, = self.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.C= urrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > 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.FileN= ame, self.CurrentLineNumber) > > > > > > - if self.__Token not in ("F", "N", "S"): #, "H", "= L", "PH", "PL"): not support > > > - raise Warning("Unknown location type '%s'" % sel= f.__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'" % sel= f._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.= CurrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Component type", self.FileName, = self.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.__= Token, 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._T= oken, 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.C= urrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Component version", self.FileNam= e, 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.__Tok= en, 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._Toke= n, 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.Cu= rrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Component CS", self.FileName, se= lf.CurrentLineNumber) > > > - if self.__Token not in ("1", "0"): > > > - raise Warning("Unknown Component CS '%s'" % self.__Toke= n, 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.C= urrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Component file", self.FileName, = self.CurrentLineNumber) > > > > > > - CompStatementObj.CompBin =3D self.__Token > > > - if CompStatementObj.CompBin !=3D '-' and CompStatementObj.Co= mpBin.replace('$(WORKSPACE)', '').find('$') =3D=3D -1: > > > + CompStatementObj.CompBin =3D self._Token > > > + if CompStatementObj.CompBin !=3D '-' and CompStatementObj.Co= mpBin.replace(TAB_WORKSPACE, '').find('$') =3D=3D -1: > > > #check for file path > > > ErrorCode, ErrorInfo =3D PathClass(NormPath(CompStatemen= tObj.CompBin), > > GenFdsGlobalVariable.WorkSpaceDir).Validate() > > > if ErrorCode !=3D 0: > > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DErr= orInfo) > > > > > > - if not self.__IsKeyword("COMP_SYM"): > > > + if not self._IsKeyword("COMP_SYM"): > > > raise Warning("expected COMP_SYM", self.FileName, self.C= urrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected Component symbol file", self.Fil= eName, self.CurrentLineNumber) > > > > > > - CompStatementObj.CompSym =3D self.__Token > > > - if CompStatementObj.CompSym !=3D '-' and CompStatementObj.Co= mpSym.replace('$(WORKSPACE)', '').find('$') =3D=3D -1: > > > + CompStatementObj.CompSym =3D self._Token > > > + if CompStatementObj.CompSym !=3D '-' and CompStatementObj.Co= mpSym.replace(TAB_WORKSPACE, '').find('$') =3D=3D -1: > > > #check for file path > > > ErrorCode, ErrorInfo =3D PathClass(NormPath(CompStatemen= tObj.CompSym), > > GenFdsGlobalVariable.WorkSpaceDir).Validate() > > > if ErrorCode !=3D 0: > > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DErr= orInfo) > > > > > > - if not self.__IsKeyword("COMP_SIZE"): > > > + if not self._IsKeyword("COMP_SIZE"): > > > raise Warning("expected COMP_SIZE", self.FileName, self.= CurrentLineNumber) > > > > > > - if not self.__IsToken("=3D"): > > > + if not self._IsToken(TAB_EQUAL_SPLIT): > > > raise Warning("expected '=3D'", self.FileName, self.Curr= entLineNumber) > > > > > > - 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.F= ileName, self.CurrentLineNumber) > > > + raise Warning("Unknown size '%s'" % self._Token, self.Fi= leName, self.CurrentLineNumber) > > > > > > VtfObj.ComponentStatementList.append(CompStatementObj) > > > return True > > > > > > - ## __GetOptionRom() method > > > + ## _GetOptionRom() method > > > # > > > # Get OptionROM section contents and store its data into Optio= nROM 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("[OP= TIONROM."): > > > self.SectionParser(S) > > > - self.__UndoToken() > > > + self._UndoToken() > > > return False > > > > > > - self.__UndoToken() > > > - if not self.__IsToken("[OptionRom.", True): > > > - raise Warning("Unknown Keyword '%s'" % self.__Token, sel= f.FileName, self.CurrentLineNumber) > > > + self._UndoToken() > > > + if not self._IsToken("[OptionRom.", True): > > > + raise Warning("Unknown Keyword '%s'" % self._Token, self= .FileName, 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.Curren= tLineNumber) > > > > > > - 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, s= elf.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.InfFi= leName), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > > if ErrorCode !=3D 0: > > > @@ -4434,71 +4344,71 @@ class FdfParser: > > > self.Profile.InfDict['ArchTBD'].append(ffsInf.InfFil= eName) > > > > > > > > > - 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.FileNam= e, self.CurrentLineNumber) > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex vendor id", self= .FileName, 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.FileNam= e, self.CurrentLineNumber) > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex class code", sel= f.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.FileNam= e, self.CurrentLineNumber) > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex device id", self= .FileName, 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.FileNam= e, self.CurrentLineNumber) > > > - if not self.__GetNextHexNumber(): > > > + if not self._GetNextHexNumber(): > > > raise Warning("expected Hex revision", self.= FileName, 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.FileNam= e, self.CurrentLineNumber) > > > - if not self.__GetNextToken(): > > > + if not self._GetNextToken(): > > > raise Warning("expected TRUE/FALSE for compr= ess", 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, Fil= e=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(BINA= RY_FILE_TYPE_BIN): > > > + if not self._IsKeyword("EFI") and not self._IsKeyword(BINARY= _FILE_TYPE_BIN): > > > raise Warning("expected Binary type (EFI/BIN)", self.Fil= eName, 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.= CurrentLineNumber) > > > - 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.F= ileName), GenFdsGlobalVariable.WorkSpaceDir).Validate() > > > if ErrorCode !=3D 0: > > > EdkLogger.error("GenFds", ErrorCode, ExtraData=3DErr= orInfo) > > > > > > 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 [], Re= fFvList =3D []): > > > - for CapsuleDataObj in CapObj.CapsuleDataList : > > > + def _GetReferencedFdCapTuple(self, CapObj, RefFdList =3D [], Ref= FvList =3D []): > > > + for CapsuleDataObj in CapObj.CapsuleDataList: > > > if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.= FvName is not None and > CapsuleDataObj.FvName.upper() > > not in RefFvList: > > > RefFvList.append (CapsuleDataObj.FvName.upper()) > > > elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataOb= j.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.F= ileStatement): > > > + if isinstance(CapsuleDataObj.Ffs, FileStatement): > > > if CapsuleDataObj.Ffs.FvName is not None and Cap= suleDataObj.Ffs.FvName.upper() not in RefFvList: > > > RefFvList.append(CapsuleDataObj.Ffs.FvName.u= pper()) > > > elif CapsuleDataObj.Ffs.FdName is not None and C= apsuleDataObj.Ffs.FdName.upper() not in RefFdList: > > > RefFdList.append(CapsuleDataObj.Ffs.FdName.u= pper()) > > > else: > > > - self.__GetReferencedFdFvTupleFromSection(Cap= suleDataObj.Ffs, RefFdList, RefFvList) > > > + self._GetReferencedFdFvTupleFromSection(Caps= uleDataObj.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 [], RefF= vList =3D []): > > > + def _GetReferencedFdFvTuple(self, FvObj, RefFdList =3D [], RefFv= List =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.upp= er() not in RefFdList: > > > RefFdList.append(FfsObj.FdName.upper()) > > > else: > > > - self.__GetReferencedFdFvTupleFromSection(FfsObj,= RefFdList, RefFvList) > > > + self._GetReferencedFdFvTupleFromSection(FfsObj, = RefFdList, 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.FvNa= me.upper() not in FvList: > > > FvList.append(SectionObj.FvName.upper()) > > > if SectionObj.Fv is not None and SectionObj.Fv.UiFvN= ame is not None and SectionObj.Fv.UiFvName.upper() not > in > > FvList: > > > FvList.append(SectionObj.Fv.UiFvName.upper()) > > > - self.__GetReferencedFdFvTuple(SectionObj.Fv, FdL= ist, FvList) > > > + self._GetReferencedFdFvTuple(SectionObj.Fv, FdLi= st, FvList) > > > > > > - if isinstance(SectionObj, CompressSection.CompressSectio= n) or isinstance(SectionObj, GuidSection.GuidSection): > > > + if isinstance(SectionObj, CompressSection) or isinstance= (SectionObj, 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, RefF= vList) > > > + self._GetReferencedFdFvTuple(FvObj, RefFdList, RefFv= List) > > > > > > for RefFdName in RefFdList: > > > if RefFdName in FdAnalyzedList: > > > continue > > > > > > LogStr +=3D "FV %s contains FD %s\n" % (FvNameFr= omStack, 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" % (= RefFdName, FvNameInFd) > > > @@ -4725,7 +4635,7 @@ class FdfParser: > > > > > > RefFvList =3D [] > > > RefFdList =3D [] > > > - self.__GetReferencedFdCapTuple(CapObj, RefFdList, Re= fFvList) > > > + self._GetReferencedFdCapTuple(CapObj, RefFdList, Ref= FvList) > > > > > > FvListLength =3D 0 > > > FdListLength =3D 0 > > > @@ -4735,7 +4645,7 @@ class FdfParser: > > > continue > > > > > > LogStr +=3D "Capsule %s contains FD %s\n" % = (CapNameFromStack, 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.= upper()] > > > else: > > > continue > > > - self.__GetReferencedFdFvTuple(FvObj, RefFdLi= st, RefFvList) > > > + self._GetReferencedFdFvTuple(FvObj, RefFdLis= t, RefFvList) > > > FvAnalyzedList.append(RefFvName) > > > > > > return False > > > diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source= /Python/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_COR= E', > > > - 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_STANDALON= E', > > > - SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STA= NDALONE' > > > - } > > > +# 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_STANDAL= ONE' > > > +} > > > > > > - # 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/Bas= eTools/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, SaveFile= OnChange > > > +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=3DN= one, IsMakefile=3DFalse, FvName=3DNone): > > > > > > - if self.NameGuid is not None and self.NameGuid.startswith('P= CD('): > > > + if self.NameGuid and self.NameGuid.startswith('PCD('): > > > PcdValue =3D GenFdsGlobalVariable.GetPcdValue(self.NameG= uid) > > > if len(PcdValue) =3D=3D 0: > > > EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defi= ned.' \ > > > @@ -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.FdfPa= rser.Profile.FvDict: > > > EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is = NOT 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.FdfPa= rser.Profile.FdDict: > > > EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is = NOT described in FDF file!" % (self.FdName)) > > > Fd =3D GenFdsGlobalVariable.FdfParser.Profile.FdDict.get= (self.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(se= lf.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.GetA= lignment(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 GuidS= ection > > > @@ -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, = GuidSection): > > > + 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 + '.= ffs') > > > GenFdsGlobalVariable.GenerateFfs(FfsFileOutput, SectionFiles= , > > > - Ffs.Ffs.FdfFvFileTypeToFile= Type.get(self.FvFileType), > > > + FdfFvFileTypeToFileType.get= (self.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/Base= Tools/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.NameGu= id) + \ > > > - Ffs.Ffs.SectionSuffix[SectionType] + S= UP_MODULE_SEC + SecNum > > > + SectionSuffix[SectionType] + SUP_MODUL= E_SEC + SecNum > > > Index =3D Index + 1 > > > OutputFile =3D os.path.join(self.OutputPath, GenSecO= utputFile) > > > 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] + S= UP_MODULE_SEC + SecNum > > > + SectionSuffix[SectionType] + SUP_MODUL= E_SEC + SecNum > > > OutputFile =3D os.path.join(self.OutputPath, GenSecOutpu= tFile) > > > GenSecInputFile =3D GenFdsGlobalVariable.MacroExtend(Gen= SecInputFile, Dict, self.CurrentArch) > > > > > > @@ -882,7 +882,7 @@ class FfsInfStatement(FfsInfStatementClassObject)= : > > > self.ModuleGuid =3D RegistryGuidStr > > > > > > GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputSection= , > > > - Ffs.Ffs.FdfFvFileTypeTo= FileType[Rule.FvFileType], > > > + FdfFvFileTypeToFileType= [Rule.FvFileType], > > > self.ModuleGuid, Fixed= =3DRule.Fixed, > > > CheckSum=3DRule.CheckSu= m, Align=3DRule.Alignment, > > > SectionAlign=3DSectionA= lignments, > > > @@ -1055,7 +1055,7 @@ class FfsInfStatement(FfsInfStatementClassObjec= t): > > > > > > FfsOutput =3D os.path.join( self.OutputPath, self.ModuleGuid= + '.ffs') > > > GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputFile, > > > - Ffs.Ffs.FdfFvFileTypeTo= FileType[Rule.FvFileType], > > > + FdfFvFileTypeToFileType= [Rule.FvFileType], > > > self.ModuleGuid, Fixed= =3DRule.Fixed, > > > CheckSum=3DRule.CheckSu= m, Align=3DRule.Alignment, > > > SectionAlign=3DAlignmen= ts, > > > diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/= Python/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-= 4BDF2EFFBC7C' > > > ## 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 = None, BlockNum=3DNone, ErasePloarity=3D'1', VtfDict=3DNone, > MacroDict > > =3D {}, Flag=3DFalse) : > > > + def AddToBuffer (self, Buffer, BaseAddress=3DNone, BlockSize=3D = None, BlockNum=3DNone, ErasePloarity=3D'1', VtfDict=3DNone, > > MacroDict =3D {}, Flag=3DFalse): > > > > > > if BaseAddress is None and self.UiFvName.upper() + 'fv' in G= enFdsGlobalVariable.ImageBinDict: > > > return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.u= pper() + '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,= ErasePloarity, VtfDict) > > > + self._InitializeInf(BaseAddress, BlockSize, BlockNum, Er= asePloarity, 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.FileStatemen= t): > > > 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, FvChi= ldAddr, 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 = None, BlockNum =3D None, ErasePloarity=3D'1', VtfDict=3DNone) : > > > + def _InitializeInf (self, BaseAddress =3D None, BlockSize=3D Non= e, 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 0= x1" + 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/BaseT= ools/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 += SUP_MODULE_SEC + Num + > > Ffs.SectionSuffix.get("FV_IMAGE")) > > > + OutputFile =3D os.path.join(OutputPath, ModuleName += SUP_MODULE_SEC + Num + > > SectionSuffix.get("FV_IMAGE")) > > > GenFdsGlobalVariable.GenerateSection(OutputFile, [Fv= FileName], > '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= _MODULE_SEC + SecNum + > > Ffs.SectionSuffix.get("FV_IMAGE")) > > > + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP= _MODULE_SEC + SecNum + > SectionSuffix.get("FV_IMAGE")) > > > GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFile= Name], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', > > IsMakefile=3DIsMakefile) > > > OutputFileList.append(OutputFile) > > > > > > diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Sou= rce/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, GuidStructureStringToGu= idString > > > +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_ERR= OR, FORMAT_INVALID, RESOURCE_NOT_AVAILABLE, > > FILE_NOT_FOUND, OPTION_MISSING, FORMAT_NOT_SUPPORTED,OPTION_VALUE_INVAL= ID > > > +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= defined", > > > ExtraData=3D"Please use '-w' switch to p= ass 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.normca= se(os.environ['EDK_SOURCE']) > > > - if (Options.debug): > > > + if Options.debug: > > > GenFdsGlobalVariable.VerboseLogger("Using Workspace:= " + Workspace) > > > if Options.GenfdsMultiThread: > > > GenFdsGlobalVariable.EnableGenfdsMultiThread =3D Tru= e > > > @@ -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.ReplaceWorkspaceMac= ro(FdfFilename) > > > > > > @@ -123,13 +119,13 @@ def main(): > > > else: > > > EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF f= ilename") > > > > > > - 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.ReplaceWorkspace= Macro(ActivePlatform) > > > > > > @@ -139,15 +135,15 @@ def main(): > > > if not os.path.isabs (ActivePlatform): > > > ActivePlatform =3D mws.join(GenFdsGlobalVariable.Wor= kSpaceDir, ActivePlatform) > > > > > > - if not os.path.exists(ActivePlatform) : > > > + if not os.path.exists(ActivePlatform): > > > EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePla= tform doesn't exist!") > > > else: > > > EdkLogger.error("GenFds", OPTION_MISSING, "Missing activ= e platform") > > > > > > - GlobalData.BuildOptionPcd =3D Options.OptionPcd if Optio= ns.OptionPcd else {} > > > + GlobalData.BuildOptionPcd =3D Options.OptionPcd if Options.O= ptionPcd else {} > > > GenFdsGlobalVariable.ActivePlatform =3D PathClass(NormPath(A= ctivePlatform)) > > > > > > - if (Options.ConfDirectory): > > > + if Options.ConfDirectory: > > > # Get alternate Conf location, if it is absolute, then j= ust use the absolute directory name > > > ConfDirectoryPath =3D os.path.normpath(Options.ConfDirec= tory) > > > if ConfDirectoryPath.startswith('"'): > > > @@ -169,7 +165,7 @@ def main(): > > > GlobalData.gConfDirectory =3D GenFdsGlobalVariable.ConfD= ir > > > BuildConfigurationFile =3D os.path.normpath(os.path.join(Con= fDirectoryPath, "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 = target.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 buil= d ARCH") > > > ArchList =3D BuildWorkSpace.BuildObject[GenFdsGlobalVari= able.ActivePlatform, TAB_COMMON, Options.BuildTarget, > > Options.ToolChain].SupArchList > > > > > > TargetArchList =3D set(BuildWorkSpace.BuildObject[GenFdsGlob= alVariable.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.Bui= ldObject[GenFdsGlobalVariable.ActivePlatform, Arch, > > Options.BuildTarget, Options.ToolChain].PlatformName > > > > > > - if (Options.outputDir): > > > + # assign platform name based on last entry in ArchList > > > + GenFdsGlobalVariable.PlatformName =3D BuildWorkSpace.BuildOb= ject[GenFdsGlobalVariable.ActivePlatform, ArchList[-1], > > Options.BuildTarget, Options.ToolChain].PlatformName > > > + > > > + if Options.outputDir: > > > OutputDirFromCommandLine =3D GenFdsGlobalVariable.Replac= eWorkspaceMacro(Options.outputDir) > > > if not os.path.isabs (OutputDirFromCommandLine): > > > OutputDirFromCommandLine =3D os.path.join(GenFdsGlob= alVariable.WorkSpaceDir, > OutputDirFromCommandLine) > > > @@ -274,27 +271,27 @@ def main(): > > > GenFdsGlobalVariable.OutputDirDict[Key] =3D OutputDir > > > > > > """ Parse Fdf file, has to place after build Workspace as FD= F 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 R= eference Detected in FDF file") > > > > > > - if (Options.uiFdName) : > > > + if Options.uiFdName: > > > if Options.uiFdName.upper() in FdfParserObj.Profile.FdDi= ct: > > > GenFds.OnlyGenerateThisFd =3D Options.uiFdName > > > else: > > > EdkLogger.error("GenFds", OPTION_VALUE_INVALID, > > > "No such an FD in FDF file: %s" % Op= tions.uiFdName) > > > > > > - if (Options.uiFvName) : > > > + if Options.uiFvName: > > > if Options.uiFvName.upper() in FdfParserObj.Profile.FvDi= ct: > > > GenFds.OnlyGenerateThisFv =3D Options.uiFvName > > > else: > > > EdkLogger.error("GenFds", OPTION_VALUE_INVALID, > > > "No such an FV in FDF file: %s" % Op= tions.uiFvName) > > > > > > - if (Options.uiCapName) : > > > + if Options.uiCapName: > > > if Options.uiCapName.upper() in FdfParserObj.Profile.Cap= suleDict: > > > 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.FdDi= ct: > > > - 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_TYP= E_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.FileNam= e, 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, p= arser): > > > # Using standard Python module optparse to parse command line option= of this tool. > > > # > > > # @retval Opt A optparse.Values object containing the parsed opt= ions > > > -# @retval Args Target of build command > > > # > > > def myOptionParser(): > > > usage =3D "%prog [options] -f input_file -a arch_list -b build_t= arget -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 t= o 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, ArchL= ist) > > > + @staticmethod > > > + def GenFd (OutputDir, FdfParserObject, WorkSpace, ArchList): > > > + GenFdsGlobalVariable.SetDir ('', FdfParserObject, WorkSpace,= ArchList) > > > > > > GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images = and their required FV and Capsule images!") > > > if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGen= erateThisCap.upper() in > > GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict: > > > @@ -470,9 +465,10 @@ class GenFds : > > > GenFdsGlobalVariable.VerboseLogger("\n Generate all = Option ROM!") > > > for OptRomObj in GenFdsGlobalVariable.FdfParser.Prof= ile.OptRomDict.values(): > > > OptRomObj.AddToBuffer(None) > > > + > > > @staticmethod > > > - def GenFfsMakefile(OutputDir, FdfParser, WorkSpace, ArchList, Gl= obalData): > > > - GenFdsGlobalVariable.SetEnv(FdfParser, WorkSpace, ArchList, = GlobalData) > > > + def GenFfsMakefile(OutputDir, FdfParserObject, WorkSpace, ArchLi= st, GlobalData): > > > + GenFdsGlobalVariable.SetEnv(FdfParserObject, WorkSpace, Arch= List, GlobalData) > > > for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.v= alues(): > > > 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(GenFdsGlobalVariabl= e.FvDir, FvName.upper() + '.Fv.map') > > > if os.path.exists(FvSpaceInfoFileName): > > > - FileLinesList =3D linecache.getlines(FvSpaceInfoFile= Name) > > > + 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 prepro= cessed > > > # @retval None > > > # > > > + @staticmethod > > > def PreprocessImage(BuildDb, DscFile): > > > PcdDict =3D BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsG= lobalVariable.TargetName, > > GenFdsGlobalVariable.ToolChainTag].Pcds > > > PcdValue =3D '' > > > @@ -600,6 +599,7 @@ class GenFds : > > > ModuleObj =3D BuildDb.BuildObject[Key, TAB_COMMON, GenFd= sGlobalVariable.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[GenFdsGlobalVar= iable.ActivePlatform, Arch, > > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] > > > PkgList =3D GenFdsGlobalVariable.WorkSpace.GetPackageLis= t(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.BaseN= ame, Module.BaseName)) > > > else: > > > GuidXRefFile.write("%s %s\n" % (Module.Guid, Mod= ule.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].Ff= sList: > > > - if not isinstance(FfsObj, FfsFileStatement.FileS= tatement): > > > + if not isinstance(FfsObj, FileStatement): > > > InfPath =3D PathClass(NormPath(mws.join(GenF= dsGlobalVariable.WorkSpaceDir, FfsObj.InfFileName))) > > > FdfModule =3D BuildDb.BuildObject[InfPath, A= rch, GenFdsGlobalVariable.TargetName, > > GenFdsGlobalVariable.ToolChainTag] > > > if FdfModule in ModuleList: > > > @@ -647,12 +642,9 @@ class GenFds : > > > else: > > > ModuleList.append(FdfModule) > > > GuidXRefFile.write("%s %s\n" % (FdfModule.Gu= id, 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(GenFdsGlobalVariabl= e.FvDir, 'Ffs') > > > - FfsPath =3D glob.glob(os.path.join(FfsPath, = FileStatementGuid) + '*') > > > + FfsPath =3D glob(os.path.join(FfsPath, FileS= tatementGuid) + '*') > > > 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+(.= pic.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 err= or > > > - 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= /BaseTools/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-1E96= 89E7349A' > > > 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(Gen= FdsGlobalVariable.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.Wor= kSpaceDir > > > - 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.Too= lChainTag > > > - Macro["TOOLCHAIN_TAG" ] =3D GenFdsGlobalVariable.Too= lChainTag > > > - Macro["TOOL_CHAIN_TAG" ] =3D GenFdsGlobalVariable.Too= lChainTag > > > - Macro["TARGET" ] =3D GenFdsGlobalVariable.Tar= getName > > > - > > > - Macro["BUILD_DIR" ] =3D GenFdsGlobalVariable.Out= putDirDict[Arch] > > > - Macro["BIN_DIR" ] =3D os.path.join(GenFdsGloba= lVariable.OutputDirDict[Arch], Arch) > > > - Macro["LIB_DIR" ] =3D os.path.join(GenFdsGloba= lVariable.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, "= OUTPUT") > > > - Macro["DEBUG_DIR" ] =3D os.path.join(BuildDir, "= DEBUG") > > > - > > > + BinDir =3D os.path.join(GenFdsGlobalVariable.OutputDirDict[A= rch], 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.To= olChainTag) and \ > > > - File.ToolChainFamily in ("", "*", GenFdsGlobalVa= riable.ToolChainFamily): > > > + if File.TagName in {"", "*", GenFdsGlobalVariable.To= olChainTag} and \ > > > + File.ToolChainFamily in {"", "*", GenFdsGlobalVa= riable.ToolChainFamily}: > > > FileList.append((File, DataType.TAB_UNKNOWN_FILE= )) > > > > > > for File in Inf.Binaries: > > > - if File.Target in [DataType.TAB_COMMON, '*', GenFdsGloba= lVariable.TargetName]: > > > + if File.Target in {DataType.TAB_COMMON, '*', GenFdsGloba= lVariable.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.Bina= ries is not None and File in Inf.Binaries: > > > + if File.IsBinary and File =3D=3D Source and Inf.Bina= ries 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.Out= putDir :%s" % OutputDir) > > > -# GenFdsGlobalVariable.OutputDirDict =3D OutputDir > > > + GenFdsGlobalVariable.VerboseLogger("GenFdsGlobalVariable.Out= putDir:%s" % OutputDir) > > > GenFdsGlobalVariable.FdfParser =3D FdfParser > > > GenFdsGlobalVariable.WorkSpace =3D WorkSpace > > > GenFdsGlobalVariable.FvDir =3D os.path.join(GenFdsGlobalVari= able.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(GenFdsGlobalVar= iable.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_BRE= AK) > > > BsAddress =3D '0' > > > for Arch in ArchList: > > > if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlob= alVariable.ActivePlatform, Arch, > > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsB= aseAddress: > > > @@ -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[GenFdsGlob= alVariable.ActivePlatform, Arch, > > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtB= aseAddress: > > > - RtAddress =3D GenFdsGlobalVariable.WorkSpace.BuildOb= ject[GenFdsGlobalVariable.ActivePlatform, Arch, > > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtB= aseAddress > > > + for Arch in reversed(ArchList): > > > + temp =3D GenFdsGlobalVariable.WorkSpace.BuildObject[GenF= dsGlobalVariable.ActivePlatform, Arch, > > GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtB= aseAddress > > > + 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_BRE= AK) > > > BsAddress =3D '0' > > > for Arch in ArchList: > > > BsAddress =3D GenFdsGlobalVariable.WorkSpace.BuildObject= [GenFdsGlobalVariable.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, GlobalDat= a.gGlobalDefines['TARGET'], > > > - GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBaseA= ddress: > > > - RtAddress =3D GenFdsGlobalVariable.WorkSpace.BuildOb= ject[ > > > - GenFdsGlobalVariable.ActivePlatform, Arch, Globa= lData.gGlobalDefines['TARGET'], > > > - GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtB= aseAddress > > > + GlobalData.gGlobalDefines["TOOL_CHAIN_TAG"]].RtBaseA= ddress > > > + 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.= WorkSpaceDir) > > > @@ -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, up= date 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= .SecCmdList: > > > GenFdsGlobalVariable.SecCmdList.append(' '.join(= Cmd).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= =3DNone, 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 need= s 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 ca= ll " + 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 GenFdsGlobalVariab= le.SharpCounter + 1 > > > if GenFdsGlobalVariable.SharpCounter % GenFdsGlobalVaria= ble.SharpNumberPerLine =3D=3D 0: > > > - sys.stdout.write('\n') > > > + stdout.write('\n') > > > > > > try: > > > - PopenObject =3D subprocess.Popen(' '.join(cmd), stdout= =3Dsubprocess.PIPE, stderr=3Dsubprocess.PIPE, shell=3DTrue) > > > + PopenObject =3D Popen(' '.join(cmd), stdout=3DPIPE, stde= rr=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, Ext= raData) > > > > > > + @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 p= air > > > # > > > + @staticmethod > > > def MacroExtend (Str, MacroDict=3D{}, Arch=3DDataType.TAB_COMMON= ): > > > - if Str is None : > > > + if Str is None: > > > return None > > > > > > - Dict =3D {'$(WORKSPACE)' : GenFdsGlobalVariable.WorkSpaceD= ir, > > > - '$(EDK_SOURCE)' : GenFdsGlobalVariable.EdkSourceDir= , > > > + Dict =3D {'$(WORKSPACE)': GenFdsGlobalVariable.WorkSpaceDir, > > > + '$(EDK_SOURCE)': GenFdsGlobalVariable.EdkSourceDir, > > > # '$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputD= irFromDsc, > > > - '$(TARGET)' : GenFdsGlobalVariable.TargetName, > > > - '$(TOOL_CHAIN_TAG)' : GenFdsGlobalVariable.ToolChain= Tag, > > > - '$(SPACE)' : ' ' > > > + '$(TARGET)': GenFdsGlobalVariable.TargetName, > > > + '$(TOOL_CHAIN_TAG)': GenFdsGlobalVariable.ToolChainT= ag, > > > + '$(SPACE)': ' ' > > > } > > > - OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[GenF= dsGlobalVariable.ArchList[0]] > > > + > > > if Arch !=3D DataType.TAB_COMMON and Arch in GenFdsGlobalVar= iable.ArchList: > > > OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[= Arch] > > > + else: > > > + OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[= GenFdsGlobalVariable.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().sp= lit('.') > > > TokenSpace =3D PcdPair[0] > > > TokenCName =3D PcdPair[1] > > > > > > - PcdValue =3D '' > > > for Arch in GenFdsGlobalVariable.ArchList: > > > Platform =3D GenFdsGlobalVariable.WorkSpace.BuildObject[= GenFdsGlobalVariable.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.GetPackage= List(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/BaseTool= s/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/= Source/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/Sou= rce/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 Regio= n > > > + 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/= Source/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.StringDa= ta) > > > self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) > > > > > > - OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MOD= ULE_SEC + SecNum + > > Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI)) > > > + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MOD= ULE_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= /Source/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= .
> > > +# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved= .
> > > # > > > # This program and the accompanying materials > > > # are licensed and made available under the terms and conditions of= the 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.StringDa= ta) > > > self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) > > > > > > OutputFile =3D os.path.join(OutputPath, > > > - ModuleName + SUP_MODULE_SEC + SecN= um + Ffs.SectionSuffix.get('VERSION')) > > > + ModuleName + SUP_MODULE_SEC + SecN= um + 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.ReplaceWorkspaceMac= ro(self.FileName) > > > FileNameStr =3D GenFdsGlobalVariable.MacroExtend(FileNam= eStr, Dict) > > > FileObj =3D open(FileNameStr, 'r') > > > StringData =3D FileObj.read() > > > StringData =3D '"' + StringData + '"' > > > FileObj.close() > > > - else: > > > - StringData =3D '' > > > GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SE= CTION_VERSION', > > > Ver=3DStringData, Build= Number=3Dself.BuildNum, IsMakefile=3DIsMakefile) > > > OutputFileList =3D [] > > > diff --git a/BaseTools/Source/Python/GenFds/Vtf.py b/BaseTools/Source= /Python/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= .UiName + '.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,= self.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.ReplaceWorkspaceM= acro(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= /Source/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(.+)DEPENDENC= Y_END", re.DOTALL) > > > @@ -1853,8 +1854,8 @@ class FdRegionReport(object): > > > # > > > # Add PEI and DXE a priori files GUIDs defined in PI specifi= cation. > > > # > > > - self._GuidsDb["1B45CC0A-156A-428A-AF62-49864DA0E6E6"] =3D "P= EI Apriori" > > > - self._GuidsDb["FC510EE7-FFDC-11D4-BD41-0080C73C8881"] =3D "D= XE 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 > > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel