From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789404720277.24778357740126; Tue, 3 Apr 2018 14:03:24 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9F6A6226085B4; Tue, 3 Apr 2018 14:03:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1AC67221467CC for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710154" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:01 -0700 Message-Id: <016c7d4269f748607394053380b5b7ebe335257e.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 01/10] BaseTools: Use local variable for list of constants. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" instead of listing in multiple places, use a single list. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/GenC.py | 30 +++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 4d9ea1b2a8b1..8d76aabd5367 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -41,6 +41,8 @@ gItemTypeStringDatabase =3D { TAB_PCDS_DYNAMIC_EX_HII : '', } =20 +_NumericDataTypesList =3D ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN= '] + ## Dynamic PCD types gDynamicPcd =3D [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNA= MIC_VPD, TAB_PCDS_DYNAMIC_HII] =20 @@ -869,7 +871,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH): TokenCNameList.append(TokenCName) =20 def GetPcdSize(Pcd): - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLE= AN']: + if Pcd.DatumType not in _NumericDataTypesList: Value =3D Pcd.DefaultValue if Value in [None, '']: return 1 @@ -975,7 +977,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTo= kenName)) AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (G= etModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('// #define %s LibPcdGetExSize(&%s, %s)\n' % = (GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64'= , 'BOOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibP= cdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLi= b, Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibP= cdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, Datu= mSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) else: @@ -985,7 +987,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExToken= Name)) AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetM= odeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('#define %s LibPcdGetExSize(&%s, %s)\n' % (Get= ModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64'= , 'BOOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= etEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, = Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= etEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSi= zeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) else: @@ -1004,7 +1006,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): else: AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName= , DatumSizeLib, PcdTokenName)) AutoGenH.Append('#define %s LibPcdGetSize(%s)\n' % (GetModeSi= zeName, PcdTokenName)) - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64'= , 'BOOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= et%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdToken= Name)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= et%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, = PcdTokenName)) else: @@ -1081,7 +1083,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): ExtraData=3D"[%s]" % str(Info)) if not Value.endswith('U'): Value +=3D 'U' - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'B= OOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize =3D=3D '': EdkLogger.error("build", AUTOGEN_ERROR, "Unknown [MaxDatumSize] of PCD [%s.%s]" % = (Pcd.TokenSpaceGuidCName, TokenCName), @@ -1132,7 +1134,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): else: PcdValueName =3D '_PCD_VALUE_' + TokenCName =20 - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'B= OOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: # # For unicode, UINT16 array will be generated, so the alignmen= t of unicode is guaranteed. # @@ -1180,7 +1182,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, Pcd= VariableName)) =20 if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE: - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64'= , 'BOOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatc= hPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s,= (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName= , Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatc= hPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s= , (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeSta= tusName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName)) else: @@ -1250,7 +1252,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): =20 Type =3D '' Array =3D '' - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLE= AN']: + if Pcd.DatumType not in _NumericDataTypesList: if Pcd.DefaultValue[0]=3D=3D '{': Type =3D '(VOID *)' Array =3D '[]' @@ -1275,7 +1277,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTo= kenName)) AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (G= etModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('// #define %s LibPcdGetExSize(&%s, %s)\n' % = (GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64'= , 'BOOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibP= cdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLi= b, Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibP= cdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, Datu= mSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) else: @@ -1285,7 +1287,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExToken= Name)) AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetM= odeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('#define %s LibPcdGetExSize(&%s, %s)\n' % (Get= ModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64'= , 'BOOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= etEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, = Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= etEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSi= zeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) else: @@ -1306,7 +1308,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): else: AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName= , DatumSizeLib, PcdTokenName)) AutoGenH.Append('#define %s LibPcdGetSize(%s)\n' % (GetModeSi= zeName, PcdTokenName)) - if DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'B= OOLEAN']: + if DatumType not in _NumericDataTypesList: AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= et%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdToken= Name)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdS= et%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, = PcdTokenName)) else: @@ -1314,7 +1316,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): AutoGenH.Append('#define %s(Value) LibPcdSet%sS(%s, (Valu= e))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName)) if PcdItemType =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE: PcdVariableName =3D '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PA= TCHABLE_IN_MODULE] + '_' + TokenCName - if DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLE= AN']: + if DatumType not in _NumericDataTypesList: ArraySize =3D int(Pcd.MaxDatumSize, 0) if Pcd.DefaultValue[0] =3D=3D 'L': ArraySize =3D ArraySize / 2 @@ -1325,7 +1327,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): AutoGenH.Append('extern volatile %s %s%s;\n' % (DatumType, P= cdVariableName, Array)) AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeNa= me, Type, TokenCName)) PcdDataSize =3D GetPcdSize(Pcd) - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'B= OOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcd= SetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UI= NTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, To= kenCName, TokenCName, TokenCName)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcd= SetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (U= INTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusN= ame, TokenCName, TokenCName, TokenCName)) AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, Pc= d.MaxDatumSize)) @@ -1349,7 +1351,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed= to set value for a FIXED_AT_BUILD PCD\n' % SetModeName) =20 if PcdItemType =3D=3D TAB_PCDS_FIXED_AT_BUILD and (key in Info.Con= stPcd or (Info.IsLibrary and not Info._ReferenceModules)): - if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64'= , 'BOOLEAN']: + if Pcd.DatumType not in _NumericDataTypesList: AutoGenH.Append('#define _PCD_VALUE_%s %s%s\n' %(TokenCNam= e, Type, PcdVariableName)) else: AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName,= Pcd.DefaultValue)) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789397592890.9234368050264; Tue, 3 Apr 2018 14:03:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 11FDE2256863F; Tue, 3 Apr 2018 14:03:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E09A321E0816E for ; Tue, 3 Apr 2018 14:03:11 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710156" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:02 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 02/10] BaseTools: use built in dict instead of custom version. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We dont use any feature added by custom dictionary class. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Eot/EotGlobalData.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py b/BaseTools/Sourc= e/Python/Eot/EotGlobalData.py index dd4ff4cf5eb6..a4654853ab5e 100644 --- a/BaseTools/Source/Python/Eot/EotGlobalData.py +++ b/BaseTools/Source/Python/Eot/EotGlobalData.py @@ -70,7 +70,7 @@ gSOURCE_FILES =3D 'Log_SourceFiles.log' gOP_SOURCE_FILES =3D open(gSOURCE_FILES, 'w+') =20 # Dict for GUID found in DEC files -gGuidDict =3D sdict() +gGuidDict =3D dict() =20 # Dict for hard coded GUID Macros # {GuidName : [GuidMacro : GuidValue]} --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789407333800.3900707088826; Tue, 3 Apr 2018 14:03:27 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C86D9226085B8; Tue, 3 Apr 2018 14:03:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 26B7621E0816E for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710159" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:03 -0700 Message-Id: <6ccf995d0d9d147bd3595e0d224de11ad1da2bf5.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 03/10] BaseTools: Eot tool never populates this dictionary X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" we initialize this dict and then check it's contents, but never add items. we can remove it without any effect. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Eot/Eot.py | 8 -------- BaseTools/Source/Python/Eot/EotGlobalData.py | 4 ---- 2 files changed, 12 deletions(-) diff --git a/BaseTools/Source/Python/Eot/Eot.py b/BaseTools/Source/Python/E= ot/Eot.py index c4164199acf3..45c97bb258f2 100644 --- a/BaseTools/Source/Python/Eot/Eot.py +++ b/BaseTools/Source/Python/Eot/Eot.py @@ -340,14 +340,6 @@ class Eot(object): GuidMacro2 =3D '' GuidValue =3D '' =20 - # Find value for hardcode guid macro - if GuidName in EotGlobalData.gGuidMacroDict: - GuidMacro =3D EotGlobalData.gGuidMacroDict[GuidName][0] - GuidValue =3D EotGlobalData.gGuidMacroDict[GuidName][1] - SqlCommand =3D """update Report set GuidMacro =3D '%s', Gu= idValue =3D '%s' where GuidName =3D '%s'""" %(GuidMacro, GuidValue, GuidNam= e) - EotGlobalData.gDb.TblReport.Exec(SqlCommand) - continue - # Find guid value defined in Dec file if GuidName in EotGlobalData.gGuidDict: GuidValue =3D EotGlobalData.gGuidDict[GuidName] diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py b/BaseTools/Sourc= e/Python/Eot/EotGlobalData.py index a4654853ab5e..dea4206e9d48 100644 --- a/BaseTools/Source/Python/Eot/EotGlobalData.py +++ b/BaseTools/Source/Python/Eot/EotGlobalData.py @@ -72,10 +72,6 @@ gOP_SOURCE_FILES =3D open(gSOURCE_FILES, 'w+') # Dict for GUID found in DEC files gGuidDict =3D dict() =20 -# Dict for hard coded GUID Macros -# {GuidName : [GuidMacro : GuidValue]} -gGuidMacroDict =3D sdict() - # Dict for PPI gPpiList =3D {} =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789399814650.4136794124588; Tue, 3 Apr 2018 14:03:19 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 46355225F321E; Tue, 3 Apr 2018 14:03:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EC42221FB7D5E for ; Tue, 3 Apr 2018 14:03:11 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710163" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:04 -0700 Message-Id: <208275f2d5e0321ce86a03b8a280a5f8137cd07e.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 04/10] BaseTools: remove unused import statement X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/GenFds/GenFds.py | 1 - 1 file changed, 1 deletion(-) diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index 49e26424bbfc..810a1f86e948 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -24,7 +24,6 @@ import Common.BuildToolError as BuildToolError from GenFdsGlobalVariable import GenFdsGlobalVariable from Workspace.WorkspaceDatabase import WorkspaceDatabase from Workspace.BuildClassObject import PcdClassObject -from Workspace.BuildClassObject import ModuleBuildClassObject import RuleComplexFile from EfiSection import EfiSection import StringIO --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789402348491.15579704749723; Tue, 3 Apr 2018 14:03:22 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 73A53226085AE; Tue, 3 Apr 2018 14:03:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 04647226C7C35 for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710166" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:05 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 05/10] BaseTools - AutoGen - replace custom dictionary class with python standard one X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We have a custom ordered dictionary class. works fine with python OrderedD= ict version. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 31 ++++++++++---------- BaseTools/Source/Python/AutoGen/GenMake.py | 3 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 3384fdb70b7e..3865827f26df 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -45,6 +45,7 @@ import InfSectionParser import datetime import hashlib from GenVar import VariableMgr,var_info +from collections import OrderedDict =20 ## Regular expression for splitting Dependency Expression string into toke= ns gDepexTokenPattern =3D re.compile("(\(|\)|\w+| \S+\.inf)") @@ -892,7 +893,7 @@ class WorkspaceAutoGen(AutoGen): ] =20 # This dict store PCDs which are not used by any modules with spec= ified arches - UnusedPcd =3D sdict() + UnusedPcd =3D OrderedDict() for Pa in self.AutoGenObjectList: # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid for Pcd in Pa.Platform.Pcds: @@ -2084,7 +2085,7 @@ class PlatformAutoGen(AutoGen): ## Generate Token Number for all PCD def _GetPcdTokenNumbers(self): if self._PcdTokenNumber is None: - self._PcdTokenNumber =3D sdict() + self._PcdTokenNumber =3D OrderedDict() TokenNumber =3D 1 # # Make the Dynamic and DynamicEx PCD use within different Toke= nNumber area.=20 @@ -2207,8 +2208,8 @@ class PlatformAutoGen(AutoGen): # EdkII module LibraryConsumerList =3D [Module] Constructor =3D [] - ConsumedByList =3D sdict() - LibraryInstance =3D sdict() + ConsumedByList =3D OrderedDict() + LibraryInstance =3D OrderedDict() =20 EdkLogger.verbose("") EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(= Module), self.Arch)) @@ -2880,14 +2881,14 @@ class ModuleAutoGen(AutoGen): self._DerivedPackageList =3D None self._ModulePcdList =3D None self._LibraryPcdList =3D None - self._PcdComments =3D sdict() + self._PcdComments =3D OrderedDict() self._GuidList =3D None self._GuidsUsedByPcd =3D None - self._GuidComments =3D sdict() + self._GuidComments =3D OrderedDict() self._ProtocolList =3D None - self._ProtocolComments =3D sdict() + self._ProtocolComments =3D OrderedDict() self._PpiList =3D None - self._PpiComments =3D sdict() + self._PpiComments =3D OrderedDict() self._DepexList =3D None self._DepexExpressionList =3D None self._BuildOption =3D None @@ -2943,7 +2944,7 @@ class ModuleAutoGen(AutoGen): # Macros could be used in build_rule.txt (also Makefile) def _GetMacros(self): if self._Macro is None: - self._Macro =3D sdict() + self._Macro =3D OrderedDict() self._Macro["WORKSPACE" ] =3D self.WorkspaceDir self._Macro["MODULE_NAME" ] =3D self.Name self._Macro["MODULE_NAME_GUID" ] =3D self._GetUniqueBaseN= ame() @@ -3695,7 +3696,7 @@ class ModuleAutoGen(AutoGen): # def _GetLibraryPcdList(self): if self._LibraryPcdList is None: - Pcds =3D sdict() + Pcds =3D OrderedDict() if not self.IsLibrary: # get PCDs from dependent libraries for Library in self.DependentLibraryList: @@ -3717,7 +3718,7 @@ class ModuleAutoGen(AutoGen): # def _GetGuidList(self): if self._GuidList is None: - self._GuidList =3D sdict() + self._GuidList =3D OrderedDict() self._GuidList.update(self.Module.Guids) for Library in self.DependentLibraryList: self._GuidList.update(Library.Guids) @@ -3727,7 +3728,7 @@ class ModuleAutoGen(AutoGen): =20 def GetGuidsUsedByPcd(self): if self._GuidsUsedByPcd is None: - self._GuidsUsedByPcd =3D sdict() + self._GuidsUsedByPcd =3D OrderedDict() self._GuidsUsedByPcd.update(self.Module.GetGuidsUsedByPcd()) for Library in self.DependentLibraryList: self._GuidsUsedByPcd.update(Library.GetGuidsUsedByPcd()) @@ -3738,7 +3739,7 @@ class ModuleAutoGen(AutoGen): # def _GetProtocolList(self): if self._ProtocolList is None: - self._ProtocolList =3D sdict() + self._ProtocolList =3D OrderedDict() self._ProtocolList.update(self.Module.Protocols) for Library in self.DependentLibraryList: self._ProtocolList.update(Library.Protocols) @@ -3752,7 +3753,7 @@ class ModuleAutoGen(AutoGen): # def _GetPpiList(self): if self._PpiList is None: - self._PpiList =3D sdict() + self._PpiList =3D OrderedDict() self._PpiList.update(self.Module.Ppis) for Library in self.DependentLibraryList: self._PpiList.update(Library.Ppis) @@ -3983,7 +3984,7 @@ class ModuleAutoGen(AutoGen): PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, 'DynamicEx')) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, 'Dynamic')) PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName) - GuidList =3D sdict() + GuidList =3D OrderedDict() GuidList.update(self.GuidList) for TokenSpace in self.GetGuidsUsedByPcd(): # If token space is not referred by patch PCD or Ex PCD, remov= e the GUID from GUID list diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index dcdfcca1a5b0..533fdb54231c 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -25,6 +25,7 @@ from Common.Misc import * from Common.String import * from BuildEngine import * import Common.GlobalData as GlobalData +from collections import OrderedDict =20 ## Regular expression for finding header file inclusions gIncludePattern =3D re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r= \n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)"= , re.MULTILINE | re.UNICODE | re.IGNORECASE) @@ -442,7 +443,7 @@ cleanlib: self.LibraryMakefileList =3D [] self.LibraryBuildDirectoryList =3D [] self.SystemLibraryList =3D [] - self.Macros =3D sdict() + self.Macros =3D OrderedDict() self.Macros["OUTPUT_DIR" ] =3D self._AutoGenObject.Macros["OU= TPUT_DIR"] self.Macros["DEBUG_DIR" ] =3D self._AutoGenObject.Macros["DE= BUG_DIR"] self.Macros["MODULE_BUILD_DIR"] =3D self._AutoGenObject.Macros["MO= DULE_BUILD_DIR"] --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789395116710.4139569811534; Tue, 3 Apr 2018 14:03:15 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DAA07221467D2; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CB78F226C7C3A for ; Tue, 3 Apr 2018 14:03:11 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710169" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:06 -0700 Message-Id: <2dbec3962a2cb4c2272339ebe37815fcc7e54838.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 06/10] BaseTools: Eot remove unused code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 2 functions and a dictionary that are not used. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Eot/FvImage.py | 21 -------------------- 1 file changed, 21 deletions(-) diff --git a/BaseTools/Source/Python/Eot/FvImage.py b/BaseTools/Source/Pyth= on/Eot/FvImage.py index affca4e71e8a..472ae400506d 100644 --- a/BaseTools/Source/Python/Eot/FvImage.py +++ b/BaseTools/Source/Python/Eot/FvImage.py @@ -138,7 +138,6 @@ class FirmwareVolume(Image): self.FfsDict =3D sdict() self.OrderedFfsDict =3D sdict() self.UnDispatchedFfsDict =3D sdict() - self.NoDepexFfsDict =3D sdict() self.ProtocolList =3D sdict() =20 def CheckArchProtocol(self): @@ -284,26 +283,6 @@ class FirmwareVolume(Image): =20 self.DisPatchDxe(Db) =20 - def DisPatchNoDepexFfs(self, Db): - # Last Load Drivers without Depex - for FfsID in self.NoDepexFfsDict: - NewFfs =3D self.NoDepexFfsDict.pop(FfsID) - self.OrderedFfsDict[FfsID] =3D NewFfs - self.LoadProtocol(Db, FfsID) - - return True - - def LoadCallbackProtocol(self): - IsLoad =3D True - for Protocol in self.ProtocolList: - for Callback in self.ProtocolList[Protocol][1]: - if Callback[0] not in self.OrderedFfsDict.keys(): - IsLoad =3D False - continue - if IsLoad: - EotGlobalData.gProtocolList[Protocol.lower()] =3D self.Pro= tocolList[Protocol][0] - self.ProtocolList.pop(Protocol) - def LoadProtocol(self, Db, ModuleGuid): SqlCommand =3D """select GuidValue from Report where SourceFileFullPath in --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789410030572.9294690139145; Tue, 3 Apr 2018 14:03:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F1750226085BC; Tue, 3 Apr 2018 14:03:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3BC4221FB7D5E for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710172" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:07 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 07/10] BaseTools: use built in OrderedDict instead of custom version. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We dont use any feature added by custom dictionary class. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/DscClassObject.py | 4 ++-- BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py | 10 ++++---- BaseTools/Source/Python/CommonDataClass/PackageClass.py | 4 ++-- BaseTools/Source/Python/Eot/EotGlobalData.py | 10 ++++---- BaseTools/Source/Python/Eot/Parser.py | 3 +-- BaseTools/Source/Python/Workspace/BuildClassObject.py | 4 ++-- BaseTools/Source/Python/Workspace/DecBuildData.py | 24 ++++++++++---= ------- BaseTools/Source/Python/build/build.py | 10 ++++---- 8 files changed, 35 insertions(+), 34 deletions(-) diff --git a/BaseTools/Source/Python/Common/DscClassObject.py b/BaseTools/S= ource/Python/Common/DscClassObject.py index da3101ae0fe9..cff9ab0eefb2 100644 --- a/BaseTools/Source/Python/Common/DscClassObject.py +++ b/BaseTools/Source/Python/Common/DscClassObject.py @@ -25,7 +25,7 @@ from Dictionary import * from CommonDataClass.PlatformClass import * from CommonDataClass.CommonClass import SkuInfoClass from BuildToolError import * -from Misc import sdict +from collections import OrderedDict import GlobalData from Table.TableDsc import TableDsc from Common.LongFilePathSupport import OpenLongFilePath as open @@ -732,7 +732,7 @@ class Dsc(object): # def GenComponents(self, ContainerFile): EdkLogger.debug(2, "Generate %s ..." % TAB_COMPONENTS) - Components =3D sdict() + Components =3D OrderedDict() # # Get all include files # diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py b/BaseTo= ols/Source/Python/Common/EdkIIWorkspaceBuild.py index c0966d526519..c4f45b7c59c2 100644 --- a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py +++ b/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py @@ -22,7 +22,7 @@ from DecClassObject import * from DscClassObject import * from String import * from BuildToolError import * -from Misc import sdict +from collections import OrderedDict import Database as Database import time as time =20 @@ -189,7 +189,7 @@ class ModuleBuildClassObject(object): =20 self.Binaries =3D [] self.Sources =3D [] - self.LibraryClasses =3D sdict() + self.LibraryClasses =3D OrderedDict() self.Libraries =3D [] self.Protocols =3D [] self.Ppis =3D [] @@ -955,8 +955,8 @@ class WorkspaceBuild(object): # EdkII module LibraryConsumerList =3D [Module] Constructor =3D [] - ConsumedByList =3D sdict() - LibraryInstance =3D sdict() + ConsumedByList =3D OrderedDict() + LibraryInstance =3D OrderedDict() =20 EdkLogger.verbose("") EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(= Module), Arch)) @@ -1097,7 +1097,7 @@ class WorkspaceBuild(object): # The DAG Topo sort produces the destructor order, so the list of = constructors must generated in the reverse order # SortedLibraryList.reverse() - Module.LibraryClasses =3D sdict() + Module.LibraryClasses =3D OrderedDict() for L in SortedLibraryList: for Lc in L.LibraryClass: Module.LibraryClasses[Lc.LibraryClass, ModuleType] =3D str= (L) diff --git a/BaseTools/Source/Python/CommonDataClass/PackageClass.py b/Base= Tools/Source/Python/CommonDataClass/PackageClass.py index 89d4d0797fe1..ba7d7eb67911 100644 --- a/BaseTools/Source/Python/CommonDataClass/PackageClass.py +++ b/BaseTools/Source/Python/CommonDataClass/PackageClass.py @@ -14,7 +14,7 @@ # Import Modules # from CommonClass import * -from Common.Misc import sdict +from collections import OrderedDict =20 ## PackageHeaderClass # @@ -107,7 +107,7 @@ class PackageClass(object): self.IndustryStdHeaders =3D [] self.ModuleFiles =3D [] # {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj} - self.Modules =3D sdict() + self.Modules =3D OrderedDict() self.PackageIncludePkgHeaders =3D [] self.GuidDeclarations =3D [] self.ProtocolDeclarations =3D [] diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py b/BaseTools/Sourc= e/Python/Eot/EotGlobalData.py index dea4206e9d48..7689b76da9d6 100644 --- a/BaseTools/Source/Python/Eot/EotGlobalData.py +++ b/BaseTools/Source/Python/Eot/EotGlobalData.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from Common.Misc import sdict +from collections import OrderedDict from Common.LongFilePathSupport import OpenLongFilePath as open =20 gEFI_SOURCE =3D '' @@ -79,12 +79,12 @@ gPpiList =3D {} gProtocolList =3D {} =20 # Dict for consumed PPI function calling -gConsumedPpiLibrary =3D sdict() +gConsumedPpiLibrary =3D OrderedDict() gConsumedPpiLibrary['EfiCommonLocateInterface'] =3D 0 gConsumedPpiLibrary['PeiServicesLocatePpi'] =3D 0 =20 # Dict for produced PROTOCOL function calling -gProducedProtocolLibrary =3D sdict() +gProducedProtocolLibrary =3D OrderedDict() gProducedProtocolLibrary['RegisterEsalClass'] =3D 0 gProducedProtocolLibrary['CoreInstallProtocolInterface'] =3D 1 gProducedProtocolLibrary['CoreInstallMultipleProtocolInterfaces'] =3D -1 @@ -95,14 +95,14 @@ gProducedProtocolLibrary['LibInstallProtocolInterfaces'= ] =3D 1 gProducedProtocolLibrary['LibReinstallProtocolInterfaces'] =3D 1 =20 # Dict for consumed PROTOCOL function calling -gConsumedProtocolLibrary =3D sdict() +gConsumedProtocolLibrary =3D OrderedDict() gConsumedProtocolLibrary['EfiHandleProtocol'] =3D 0 gConsumedProtocolLibrary['EfiLocateProtocolHandleBuffers'] =3D 0 gConsumedProtocolLibrary['EfiLocateProtocolInterface'] =3D 0 gConsumedProtocolLibrary['EfiHandleProtocol'] =3D 1 =20 # Dict for callback PROTOCOL function callling -gCallbackProtocolLibrary =3D sdict() +gCallbackProtocolLibrary =3D OrderedDict() gCallbackProtocolLibrary['EfiRegisterProtocolCallback'] =3D 2 =20 # Dict for ARCH PROTOCOL diff --git a/BaseTools/Source/Python/Eot/Parser.py b/BaseTools/Source/Pytho= n/Eot/Parser.py index ab19e30b69aa..14c287588a01 100644 --- a/BaseTools/Source/Python/Eot/Parser.py +++ b/BaseTools/Source/Python/Eot/Parser.py @@ -21,7 +21,6 @@ from Common.DataType import * from CommonDataClass.DataClass import * from Common.String import CleanString, GetSplitValueList, ReplaceMacro import EotGlobalData -from Common.Misc import sdict from Common.String import GetSplitList from Common.LongFilePathSupport import OpenLongFilePath as open =20 @@ -623,7 +622,7 @@ def SearchProtocols(SqlCommand, Table, SourceFileID, So= urceFileFullPath, ItemMod # @param ItemMode: Mode of item # def SearchFunctionCalling(Table, SourceFileID, SourceFileFullPath, ItemTyp= e, ItemMode): - LibraryList =3D sdict() + LibraryList =3D {} Db =3D EotGlobalData.gDb.TblReport Parameters, ItemName, GuidName, GuidMacro, GuidValue, BelongsToFunctio= n =3D [], '', '', '', '', '' if ItemType =3D=3D 'Protocol' and ItemMode =3D=3D 'Produced': diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTo= ols/Source/Python/Workspace/BuildClassObject.py index 90c8246806d8..e95a8fd24b94 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -13,7 +13,7 @@ =20 import Common.LongFilePathOs as os =20 -from Common.Misc import sdict +from collections import OrderedDict from Common.Misc import RealPath2 from Common.BuildToolError import * from Common.DataType import * @@ -281,7 +281,7 @@ class ModuleBuildClassObject(object): =20 self.Binaries =3D [] self.Sources =3D [] - self.LibraryClasses =3D sdict() + self.LibraryClasses =3D OrderedDict() self.Libraries =3D [] self.Protocols =3D [] self.Ppis =3D [] diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/= Source/Python/Workspace/DecBuildData.py index 49ef1df4aa76..ccd6cc6a3754 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -199,9 +199,9 @@ class DecBuildData(PackageBuildClassObject): if Name not in NameList: NameList.append(Name) ProtocolDict[Arch, Name] =3D Guid - # use sdict to keep the order - self._Protocols =3D sdict() - self._PrivateProtocols =3D sdict() + # use OrderedDict to keep the order + self._Protocols =3D OrderedDict() + self._PrivateProtocols =3D OrderedDict() for Name in NameList: # # limit the ARCH to self._Arch, if no self._Arch found, td= ict @@ -241,9 +241,9 @@ class DecBuildData(PackageBuildClassObject): if Name not in NameList: NameList.append(Name) PpiDict[Arch, Name] =3D Guid - # use sdict to keep the order - self._Ppis =3D sdict() - self._PrivatePpis =3D sdict() + # use OrderedDict to keep the order + self._Ppis =3D OrderedDict() + self._PrivatePpis =3D OrderedDict() for Name in NameList: # # limit the ARCH to self._Arch, if no self._Arch found, td= ict @@ -283,9 +283,9 @@ class DecBuildData(PackageBuildClassObject): if Name not in NameList: NameList.append(Name) GuidDict[Arch, Name] =3D Guid - # use sdict to keep the order - self._Guids =3D sdict() - self._PrivateGuids =3D sdict() + # use OrderedDict to keep the order + self._Guids =3D OrderedDict() + self._PrivateGuids =3D OrderedDict() for Name in NameList: # # limit the ARCH to self._Arch, if no self._Arch found, td= ict @@ -350,7 +350,7 @@ class DecBuildData(PackageBuildClassObject): EdkLogger.error('build', ErrorCode, ExtraData=3DErrorI= nfo, File=3Dself.MetaFile, Line=3DLineNo) LibraryClassSet.add(LibraryClass) LibraryClassDict[Arch, LibraryClass] =3D File - self._LibraryClasses =3D sdict() + self._LibraryClasses =3D OrderedDict() for LibraryClass in LibraryClassSet: self._LibraryClasses[LibraryClass] =3D LibraryClassDict[se= lf._Arch, LibraryClass] return self._LibraryClasses @@ -358,7 +358,7 @@ class DecBuildData(PackageBuildClassObject): ## Retrieve PCD declarations def _GetPcds(self): if self._Pcds is None: - self._Pcds =3D sdict() + self._Pcds =3D OrderedDict() self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)) self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE)) self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG)) @@ -399,7 +399,7 @@ class DecBuildData(PackageBuildClassObject): =20 ## Retrieve PCD declarations for given type def _GetPcd(self, Type): - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special kind of dict, used for selecting correct # PCD declaration for given ARCH diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index f211f8c64116..4aca28098462 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -53,6 +53,8 @@ import Common.EdkLogger import Common.GlobalData as GlobalData from GenFds.GenFds import GenFds =20 +from collections import OrderedDict + # Version and Copyright VersionNumber =3D "0.60" + ' ' + gBUILD_VERSION __version__ =3D "%prog Version " + VersionNumber @@ -438,19 +440,19 @@ class PlatformMakeUnit(BuildUnit): # class BuildTask: # queue for tasks waiting for schedule - _PendingQueue =3D sdict() + _PendingQueue =3D OrderedDict() _PendingQueueLock =3D threading.Lock() =20 # queue for tasks ready for running - _ReadyQueue =3D sdict() + _ReadyQueue =3D OrderedDict() _ReadyQueueLock =3D threading.Lock() =20 # queue for run tasks - _RunningQueue =3D sdict() + _RunningQueue =3D OrderedDict() _RunningQueueLock =3D threading.Lock() =20 # queue containing all build tasks, in case duplicate build - _TaskQueue =3D sdict() + _TaskQueue =3D OrderedDict() =20 # flag indicating error occurs in a running thread _ErrorFlag =3D threading.Event() --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789412676745.3299779913327; Tue, 3 Apr 2018 14:03:32 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 258D4226085BF; Tue, 3 Apr 2018 14:03:15 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 52285226C7C35 for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710175" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:08 -0700 Message-Id: <17db4173ab0c73eb8791ebef3ea0916c5e52a230.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 08/10] BaseTools: use combined version of OrderedDict X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" since we need order and a default entry, use collections dicts to auto generate. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 18 +++++++++++-----= -- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index abe34cf9a071..8c27b4ad5b9b 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -12,11 +12,17 @@ # =20 from Common.Misc import sdict +from collections import OrderedDict, defaultdict from Common.DataType import SUP_MODULE_USER_DEFINED from BuildClassObject import LibraryClassObject import Common.GlobalData as GlobalData from Workspace.BuildClassObject import StructurePcd =20 +class OrderedListDict(OrderedDict, defaultdict): + def __init__(self, *args, **kwargs): + super(OrderedListDict, self).__init__(*args, **kwargs) + self.default_factory =3D list + ## Get all packages from platform for specified arch, target and toolchain # # @param Platform: DscBuildData instance @@ -106,7 +112,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To # EdkII module LibraryConsumerList =3D [Module] Constructor =3D [] - ConsumedByList =3D sdict() + ConsumedByList =3D OrderedListDict() LibraryInstance =3D sdict() =20 while len(LibraryConsumerList) > 0: @@ -145,8 +151,6 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To if LibraryModule.ConstructorList !=3D [] and LibraryModule not= in Constructor: Constructor.append(LibraryModule) =20 - if LibraryModule not in ConsumedByList: - ConsumedByList[LibraryModule] =3D [] # don't add current module itself to consumer list if M !=3D Module: if M in ConsumedByList[LibraryModule]: @@ -164,7 +168,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To for LibraryClassName in LibraryInstance: M =3D LibraryInstance[LibraryClassName] LibraryList.append(M) - if ConsumedByList[M] =3D=3D []: + if len(ConsumedByList[M]) =3D=3D 0: Q.append(M) =20 # @@ -185,7 +189,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To # remove edge e from the graph if Node has no construc= tor ConsumedByList[Item].remove(Node) EdgeRemoved =3D True - if ConsumedByList[Item] =3D=3D []: + if len(ConsumedByList[Item]) =3D=3D 0: # insert Item into Q Q.insert(0, Item) break @@ -207,7 +211,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To # remove edge e from the graph ConsumedByList[Item].remove(Node) =20 - if ConsumedByList[Item] !=3D []: + if len(ConsumedByList[Item]) !=3D 0: continue # insert Item into Q, if Item has no other incoming edges Q.insert(0, Item) @@ -216,7 +220,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To # if any remaining node Item in the graph has a constructor and an inc= oming edge, then the graph has a cycle # for Item in LibraryList: - if ConsumedByList[Item] !=3D [] and Item in Constructor and len(Co= nstructor) > 1: + if len(ConsumedByList[Item]) !=3D 0 and Item in Constructor and le= n(Constructor) > 1: return [] if Item not in SortedLibraryList: SortedLibraryList.append(Item) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789415588187.5266547005382; Tue, 3 Apr 2018 14:03:35 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 550C0226085C1; Tue, 3 Apr 2018 14:03:15 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5E017221467CC for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710180" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:09 -0700 Message-Id: <6d37f464fcf3d4472de025ce538bdeba325c19cb.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 09/10] BaseTools: Workspace - use built in OrderedDict instead of custom version. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We dont use any feature added by custom dictionary class. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Workspace/DscBuildData.py | 24 ++++----- BaseTools/Source/Python/Workspace/InfBuildData.py | 52 +++++++++-------= ---- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 3 +- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index cf9608651269..6766f059b0f7 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -635,7 +635,7 @@ class DscBuildData(PlatformBuildClassObject): ## Retrieve [SkuIds] section information def _GetSkuIds(self): if self._SkuIds is None: - self._SkuIds =3D sdict() + self._SkuIds =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_SKU_ID, self._Arch] for Record in RecordList: if Record[0] in [None, '']: @@ -662,7 +662,7 @@ class DscBuildData(PlatformBuildClassObject): return int(intstr,16) if intstr.upper().startswith("0X") else int(= intstr) def _GetDefaultStores(self): if self.DefaultStores is None: - self.DefaultStores =3D sdict() + self.DefaultStores =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_DEFAULT_STORES, self._A= rch] for Record in RecordList: if Record[0] in [None, '']: @@ -692,7 +692,7 @@ class DscBuildData(PlatformBuildClassObject): if self._Modules is not None: return self._Modules =20 - self._Modules =3D sdict() + self._Modules =3D OrderedDict() RecordList =3D self._RawData[MODEL_META_DATA_COMPONENT, self._Arch] Macros =3D self._Macros Macros["EDK_SOURCE"] =3D GlobalData.gEcpSource @@ -1122,7 +1122,7 @@ class DscBuildData(PlatformBuildClassObject): ## Retrieve all PCD settings in platform def _GetPcds(self): if self._Pcds is None: - self._Pcds =3D sdict() + self._Pcds =3D OrderedDict() self.__ParsePcdFromCommandLine() self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)) self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE)) @@ -1157,7 +1157,7 @@ class DscBuildData(PlatformBuildClassObject): ## Retrieve [BuildOptions] def _GetBuildOptions(self): if self._BuildOptions is None: - self._BuildOptions =3D sdict() + self._BuildOptions =3D OrderedDict() # # Retrieve build option for EDKII and EDK style module # @@ -1179,9 +1179,9 @@ class DscBuildData(PlatformBuildClassObject): =20 def GetBuildOptionsByModuleType(self, Edk, ModuleType): if self._ModuleTypeOptions is None: - self._ModuleTypeOptions =3D sdict() + self._ModuleTypeOptions =3D OrderedDict() if (Edk, ModuleType) not in self._ModuleTypeOptions: - options =3D sdict() + options =3D OrderedDict() self._ModuleTypeOptions[Edk, ModuleType] =3D options DriverType =3D '%s.%s' % (Edk, ModuleType) CommonDriverType =3D '%s.%s' % ('COMMON', ModuleType) @@ -1446,7 +1446,7 @@ class DscBuildData(PlatformBuildClassObject): # @retval a dict object contains settings of given PCD type # def _GetPcd(self, Type): - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH @@ -1457,7 +1457,7 @@ class DscBuildData(PlatformBuildClassObject): PcdSet =3D set() # Find out all possible PCD candidates for self._Arch RecordList =3D self._RawData[Type, self._Arch] - PcdValueDict =3D sdict() + PcdValueDict =3D OrderedDict() for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dumm= y4,Dummy5 in RecordList: SkuName =3D SkuName.upper() SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName @@ -2230,7 +2230,7 @@ class DscBuildData(PlatformBuildClassObject): def _GetDynamicPcd(self, Type): =20 =20 - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH and SKU @@ -2395,7 +2395,7 @@ class DscBuildData(PlatformBuildClassObject): =20 VariableAttrs =3D {} =20 - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH and SKU @@ -2557,7 +2557,7 @@ class DscBuildData(PlatformBuildClassObject): def _GetDynamicVpdPcd(self, Type): =20 =20 - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH and SKU diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index ded8f610c9c1..a7ffd43a0972 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by build tool # -# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License @@ -17,6 +17,7 @@ from Common.DataType import * from Common.Misc import * from types import * from MetaFileParser import * +from collections import OrderedDict =20 from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClas= sObject, PcdClassObject ## Module build information from INF file @@ -156,7 +157,7 @@ class InfBuildData(ModuleBuildClassObject): self._ModuleUnloadImageList =3D None self._ConstructorList =3D None self._DestructorList =3D None - self._Defs =3D None + self._Defs =3D OrderedDict() self._Binaries =3D None self._Sources =3D None self._LibraryClasses =3D None @@ -166,7 +167,7 @@ class InfBuildData(ModuleBuildClassObject): self._Ppis =3D None self._PpiComments =3D None self._Guids =3D None - self._GuidsUsedByPcd =3D sdict() + self._GuidsUsedByPcd =3D OrderedDict() self._GuidComments =3D None self._Includes =3D None self._Packages =3D None @@ -246,8 +247,6 @@ class InfBuildData(ModuleBuildClassObject): # items defined _PROPERTY_ don't need additional processing if Name in self: self[Name] =3D Value - if self._Defs is None: - self._Defs =3D sdict() self._Defs[Name] =3D Value self._Macros[Name] =3D Value # some special items in [Defines] section need special treatme= nt @@ -255,7 +254,7 @@ class InfBuildData(ModuleBuildClassObject): if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATI= ON_VERSION'): Name =3D 'UEFI_SPECIFICATION_VERSION' if self._Specification is None: - self._Specification =3D sdict() + self._Specification =3D OrderedDict() self._Specification[Name] =3D GetHexVerValue(Value) if self._Specification[Name] is None: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, @@ -307,8 +306,6 @@ class InfBuildData(ModuleBuildClassObject): File=3Dself.MetaFile, Line=3DRecor= d[-1]) self._CustomMakefile[TokenList[0]] =3D TokenList[1] else: - if self._Defs is None: - self._Defs =3D sdict() self._Defs[Name] =3D Value self._Macros[Name] =3D Value =20 @@ -337,14 +334,14 @@ class InfBuildData(ModuleBuildClassObject): EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_COR= E_STANDALONE module type can't be used in the module with PI_SPECIFICATION_= VERSION less than 0x00010032", File=3Dself.MetaFile) if self._ModuleType =3D=3D SUP_MODULE_MM_STANDALONE: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STA= NDALONE module type can't be used in the module with PI_SPECIFICATION_VERSI= ON less than 0x00010032", File=3Dself.MetaFile) - if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDO= R_ID' in self._Defs \ + if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._= Defs \ and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in se= lf._Defs: self._BuildType =3D 'UEFI_OPTIONROM' if 'PCI_COMPRESS' in self._Defs: if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'): EdkLogger.error("build", FORMAT_INVALID, "Expected= TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile) =20 - elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \ + elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \ and self._Defs['UEFI_HII_RESOURCE_SECTION'] =3D=3D 'TRUE': self._BuildType =3D 'UEFI_HII' else: @@ -398,7 +395,7 @@ class InfBuildData(ModuleBuildClassObject): # File=3Dself.MetaFile, Line=3DLineN= o) else: if self._BuildOptions is None: - self._BuildOptions =3D sdict() + self._BuildOptions =3D OrderedDict() =20 if ToolList[0] in self._TOOL_CODE_: Tool =3D self._TOOL_CODE_[ToolList[0]] @@ -590,11 +587,8 @@ class InfBuildData(ModuleBuildClassObject): =20 ## Retrieve definies other than above ones def _GetDefines(self): - if self._Defs is None: - if self._Header_ is None: - self._GetHeaderInfo() - if self._Defs is None: - self._Defs =3D sdict() + if len(self._Defs) =3D=3D 0 and self._Header_ is None: + self._GetHeaderInfo() return self._Defs =20 ## Retrieve binary files @@ -688,7 +682,7 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve library classes employed by this module def _GetLibraryClassUses(self): if self._LibraryClasses is None: - self._LibraryClasses =3D sdict() + self._LibraryClasses =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Ar= ch, self._Platform] for Record in RecordList: Lib =3D Record[0] @@ -717,8 +711,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve protocols consumed/produced by this module def _GetProtocols(self): if self._Protocols is None: - self._Protocols =3D sdict() - self._ProtocolComments =3D sdict() + self._Protocols =3D OrderedDict() + self._ProtocolComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_PROTOCOL, self._Arch, s= elf._Platform] for Record in RecordList: CName =3D Record[0] @@ -742,8 +736,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve PPIs consumed/produced by this module def _GetPpis(self): if self._Ppis is None: - self._Ppis =3D sdict() - self._PpiComments =3D sdict() + self._Ppis =3D OrderedDict() + self._PpiComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_PPI, self._Arch, self._= Platform] for Record in RecordList: CName =3D Record[0] @@ -767,8 +761,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve GUIDs consumed/produced by this module def _GetGuids(self): if self._Guids is None: - self._Guids =3D sdict() - self._GuidComments =3D sdict() + self._Guids =3D OrderedDict() + self._GuidComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_GUID, self._Arch, self.= _Platform] for Record in RecordList: CName =3D Record[0] @@ -869,8 +863,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve PCDs used in this module def _GetPcds(self): if self._Pcds is None: - self._Pcds =3D sdict() - self._PcdComments =3D sdict() + self._Pcds =3D OrderedDict() + self._PcdComments =3D OrderedDict() self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)) self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE)) self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG)) @@ -881,7 +875,7 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve build options specific to this module def _GetBuildOptions(self): if self._BuildOptions is None: - self._BuildOptions =3D sdict() + self._BuildOptions =3D OrderedDict() RecordList =3D self._RawData[MODEL_META_DATA_BUILD_OPTION, sel= f._Arch, self._Platform] for Record in RecordList: ToolChainFamily =3D Record[0] @@ -920,7 +914,7 @@ class InfBuildData(ModuleBuildClassObject): "'%s' module must specify the type= of [Depex] section" % self.ModuleType, File=3Dself.MetaFile) =20 - Depex =3D sdict() + Depex =3D OrderedDict() for Record in RecordList: DepexStr =3D ReplaceMacro(Record[0], self._Macros, False) Arch =3D Record[3] @@ -961,7 +955,7 @@ class InfBuildData(ModuleBuildClassObject): if self._DepexExpression is None: self._DepexExpression =3D tdict(False, 2) RecordList =3D self._RawData[MODEL_EFI_DEPEX, self._Arch] - DepexExpression =3D sdict() + DepexExpression =3D OrderedDict() for Record in RecordList: DepexStr =3D ReplaceMacro(Record[0], self._Macros, False) Arch =3D Record[3] @@ -979,7 +973,7 @@ class InfBuildData(ModuleBuildClassObject): return self._GuidsUsedByPcd ## Retrieve PCD for given type def _GetPcd(self, Type): - Pcds =3D sdict() + Pcds =3D OrderedDict() PcdDict =3D tdict(True, 4) PcdList =3D [] RecordList =3D self._RawData[Type, self._Arch, self._Platform] diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index 8c27b4ad5b9b..17ac3b105431 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from Common.Misc import sdict from collections import OrderedDict, defaultdict from Common.DataType import SUP_MODULE_USER_DEFINED from BuildClassObject import LibraryClassObject @@ -113,7 +112,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To LibraryConsumerList =3D [Module] Constructor =3D [] ConsumedByList =3D OrderedListDict() - LibraryInstance =3D sdict() + LibraryInstance =3D OrderedDict() =20 while len(LibraryConsumerList) > 0: M =3D LibraryConsumerList.pop() --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon May 6 12:48:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789418088417.3824242810749; Tue, 3 Apr 2018 14:03:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7C3E6226085C4; Tue, 3 Apr 2018 14:03:15 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6ACDB221467D2 for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710182" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:10 -0700 Message-Id: <38530efaecb65ea10842f19e46d531bf86a3e835.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 10/10] BaseTools: Remove unused code from Misc X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" remove the functions and classes remove any imports of these Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/Misc.py | 280 +------------------- BaseTools/Source/Python/Eot/Eot.py | 1 - 2 files changed, 1 insertion(+), 280 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index d1752d8a624e..5e9a104305c2 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -287,32 +287,6 @@ def ClearDuplicatedInf(): if os.path.exists(File): os.remove(File) =20 -## callback routine for processing variable option -# -# This function can be used to process variable number of option values. T= he -# typical usage of it is specify architecure list on command line. -# (e.g. -a IA32 X64 IPF) -# -# @param Option Standard callback function parameter -# @param OptionString Standard callback function parameter -# @param Value Standard callback function parameter -# @param Parser Standard callback function parameter -# -# @retval -# -def ProcessVariableArgument(Option, OptionString, Value, Parser): - assert Value is None - Value =3D [] - RawArgs =3D Parser.rargs - while RawArgs: - Arg =3D RawArgs[0] - if (Arg[:2] =3D=3D "--" and len(Arg) > 2) or \ - (Arg[:1] =3D=3D "-" and len(Arg) > 1 and Arg[1] !=3D "-"): - break - Value.append(Arg) - del RawArgs[0] - setattr(Parser.values, Option.dest, Value) - ## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C = structure style # # @param Guid The GUID string @@ -450,32 +424,6 @@ def RemoveDirectory(Directory, Recursively=3DFalse): os.chdir(CurrentDirectory) os.rmdir(Directory) =20 -## Check if given file is changed or not -# -# This method is used to check if a file is changed or not between two bu= ild -# actions. It makes use a cache to store files timestamp. -# -# @param File The path of file -# -# @retval True If the given file is changed, doesn't exist, or ca= n't be -# found in timestamp cache -# @retval False If the given file is changed -# -def IsChanged(File): - if not os.path.exists(File): - return True - - FileState =3D os.stat(File) - TimeStamp =3D FileState[-2] - - if File in gFileTimeStampCache and TimeStamp =3D=3D gFileTimeStampCach= e[File]: - FileChanged =3D False - else: - FileChanged =3D True - gFileTimeStampCache[File] =3D TimeStamp - - return FileChanged - ## Store content in file # # This method is used to save file only when its content is changed. This= is @@ -635,47 +583,6 @@ class DirCache: return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath]) return None =20 -## Get all files of a directory -# -# @param Root: Root dir -# @param SkipList : The files need be skipped -# -# @retval A list of all files -# -def GetFiles(Root, SkipList=3DNone, FullPath=3DTrue): - OriPath =3D Root - FileList =3D [] - for Root, Dirs, Files in os.walk(Root): - if SkipList: - for Item in SkipList: - if Item in Dirs: - Dirs.remove(Item) - - for File in Files: - File =3D os.path.normpath(os.path.join(Root, File)) - if not FullPath: - File =3D File[len(OriPath) + 1:] - FileList.append(File) - - return FileList - -## Check if gvien file exists or not -# -# @param File File name or path to be checked -# @param Dir The directory the file is relative to -# -# @retval True if file exists -# @retval False if file doesn't exists -# -def ValidFile(File, Ext=3DNone): - if Ext is not None: - Dummy, FileExt =3D os.path.splitext(File) - if FileExt.lower() !=3D Ext.lower(): - return False - if not os.path.exists(File): - return False - return True - def RealPath(File, Dir=3D'', OverrideDir=3D''): NewFile =3D os.path.normpath(os.path.join(Dir, File)) NewFile =3D GlobalData.gAllFiles[NewFile] @@ -710,115 +617,6 @@ def RealPath2(File, Dir=3D'', OverrideDir=3D''): =20 return None, None =20 -## Check if gvien file exists or not -# -# -def ValidFile2(AllFiles, File, Ext=3DNone, Workspace=3D'', EfiSource=3D'',= EdkSource=3D'', Dir=3D'.', OverrideDir=3D''): - NewFile =3D File - if Ext is not None: - Dummy, FileExt =3D os.path.splitext(File) - if FileExt.lower() !=3D Ext.lower(): - return False, File - - # Replace the Edk macros - if OverrideDir !=3D '' and OverrideDir is not None: - if OverrideDir.find('$(EFI_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EFI_SOURCE)', EfiSource) - if OverrideDir.find('$(EDK_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EDK_SOURCE)', EdkSource) - - # Replace the default dir to current dir - if Dir =3D=3D '.': - Dir =3D os.getcwd() - Dir =3D Dir[len(Workspace) + 1:] - - # First check if File has Edk definition itself - if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1: - NewFile =3D File.replace('$(EFI_SOURCE)', EfiSource) - NewFile =3D NewFile.replace('$(EDK_SOURCE)', EdkSource) - NewFile =3D AllFiles[os.path.normpath(NewFile)] - if NewFile is not None: - return True, NewFile - - # Second check the path with override value - if OverrideDir !=3D '' and OverrideDir is not None: - NewFile =3D AllFiles[os.path.normpath(os.path.join(OverrideDir, Fi= le))] - if NewFile is not None: - return True, NewFile - - # Last check the path with normal definitions - File =3D os.path.join(Dir, File) - NewFile =3D AllFiles[os.path.normpath(File)] - if NewFile is not None: - return True, NewFile - - return False, File - -## Check if gvien file exists or not -# -# -def ValidFile3(AllFiles, File, Workspace=3D'', EfiSource=3D'', EdkSource= =3D'', Dir=3D'.', OverrideDir=3D''): - # Replace the Edk macros - if OverrideDir !=3D '' and OverrideDir is not None: - if OverrideDir.find('$(EFI_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EFI_SOURCE)', EfiSource) - if OverrideDir.find('$(EDK_SOURCE)') > -1: - OverrideDir =3D OverrideDir.replace('$(EDK_SOURCE)', EdkSource) - - # Replace the default dir to current dir - # Dir is current module dir related to workspace - if Dir =3D=3D '.': - Dir =3D os.getcwd() - Dir =3D Dir[len(Workspace) + 1:] - - NewFile =3D File - RelaPath =3D AllFiles[os.path.normpath(Dir)] - NewRelaPath =3D RelaPath - - while(True): - # First check if File has Edk definition itself - if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') >= -1: - File =3D File.replace('$(EFI_SOURCE)', EfiSource) - File =3D File.replace('$(EDK_SOURCE)', EdkSource) - NewFile =3D AllFiles[os.path.normpath(File)] - if NewFile is not None: - NewRelaPath =3D os.path.dirname(NewFile) - File =3D os.path.basename(NewFile) - #NewRelaPath =3D NewFile[:len(NewFile) - len(File.replace(= "..\\", '').replace("../", '')) - 1] - break - - # Second check the path with override value - if OverrideDir !=3D '' and OverrideDir is not None: - NewFile =3D AllFiles[os.path.normpath(os.path.join(OverrideDir= , File))] - if NewFile is not None: - #NewRelaPath =3D os.path.dirname(NewFile) - NewRelaPath =3D NewFile[:len(NewFile) - len(File.replace("= ..\\", '').replace("../", '')) - 1] - break - - # Last check the path with normal definitions - NewFile =3D AllFiles[os.path.normpath(os.path.join(Dir, File))] - if NewFile is not None: - break - - # No file found - break - - return NewRelaPath, RelaPath, File - - -def GetRelPath(Path1, Path2): - FileName =3D os.path.basename(Path2) - L1 =3D os.path.normpath(Path1).split(os.path.normpath('/')) - L2 =3D os.path.normpath(Path2).split(os.path.normpath('/')) - for Index in range(0, len(L1)): - if L1[Index] !=3D L2[Index]: - FileName =3D '../' * (len(L1) - Index) - for Index2 in range(Index, len(L2)): - FileName =3D os.path.join(FileName, L2[Index2]) - break - return os.path.normpath(FileName) - - ## Get GUID value from given packages # # @param CName The CName of the GUID @@ -1411,36 +1209,6 @@ class tdict: keys |=3D self.data[Key].GetKeys(KeyIndex - 1) return keys =20 -## Boolean chain list -# -class Blist(UserList): - def __init__(self, initlist=3DNone): - UserList.__init__(self, initlist) - def __setitem__(self, i, item): - if item not in [True, False]: - if item =3D=3D 0: - item =3D False - else: - item =3D True - self.data[i] =3D item - def _GetResult(self): - Value =3D True - for item in self.data: - Value &=3D item - return Value - Result =3D property(_GetResult) - -def ParseConsoleLog(Filename): - Opr =3D open(os.path.normpath(Filename), 'r') - Opw =3D open(os.path.normpath(Filename + '.New'), 'w+') - for Line in Opr.readlines(): - if Line.find('.efi') > -1: - Line =3D Line[Line.rfind(' ') : Line.rfind('.efi')].strip() - Opw.write('%s\n' % Line) - - Opr.close() - Opw.close() - def IsFieldValueAnArray (Value): Value =3D Value.strip() if Value.startswith('GUID') and Value.endswith(')'): @@ -1649,7 +1417,7 @@ def ParseFieldValue (Value): ## AnalyzeDscPcd # # Analyze DSC PCD value, since there is no data type info in DSC -# This fuction is used to match functions (AnalyzePcdData, AnalyzeHiiPcdD= ata, AnalyzeVpdPcdData) used for retrieving PCD value from database +# This fuction is used to match functions (AnalyzePcdData) used for retri= eving PCD value from database # 1. Feature flag: TokenSpace.PcdCName|PcdValue # 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|MaxSize] # 3. Dynamic default: @@ -1785,52 +1553,6 @@ def AnalyzePcdData(Setting): =20 return ValueList =20 =20 -## AnalyzeHiiPcdData -# -# Analyze the pcd Value, variable name, variable Guid and variable offset. -# Used to avoid split issue while the value string contain "|" character -# -# @param[in] Setting: A String contain VariableName, VariableGuid, Varia= bleOffset, DefaultValue information; -# =20 -# @retval ValueList: A List contaian VariableName, VariableGuid, Variab= leOffset, DefaultValue.=20 -# -def AnalyzeHiiPcdData(Setting): - ValueList =3D ['', '', '', ''] - - TokenList =3D GetSplitValueList(Setting) - ValueList[0:len(TokenList)] =3D TokenList - - return ValueList - -## AnalyzeVpdPcdData -# -# Analyze the vpd pcd VpdOffset, MaxDatumSize and InitialValue. -# Used to avoid split issue while the value string contain "|" character -# -# @param[in] Setting: A String contain VpdOffset/MaxDatumSize/InitialVal= ue information; -# =20 -# @retval ValueList: A List contain VpdOffset, MaxDatumSize and Initial= Value.=20 -# -def AnalyzeVpdPcdData(Setting): - ValueList =3D ['', '', ''] - - ValueRe =3D re.compile(r'\s*L?\".*\|.*\"\s*$') - PtrValue =3D ValueRe.findall(Setting) - =20 - ValueUpdateFlag =3D False - =20 - if len(PtrValue) >=3D 1: - Setting =3D re.sub(ValueRe, '', Setting) - ValueUpdateFlag =3D True - - TokenList =3D Setting.split(TAB_VALUE_SPLIT) - ValueList[0:len(TokenList)] =3D TokenList - =20 - if ValueUpdateFlag: - ValueList[2] =3D PtrValue[0] - =20 - return ValueList =20 - ## check format of PCD value against its the datum type # # For PCD value setting diff --git a/BaseTools/Source/Python/Eot/Eot.py b/BaseTools/Source/Python/E= ot/Eot.py index 45c97bb258f2..96c339613476 100644 --- a/BaseTools/Source/Python/Eot/Eot.py +++ b/BaseTools/Source/Python/Eot/Eot.py @@ -27,7 +27,6 @@ import Database from FvImage import * from array import array from Report import Report -from Common.Misc import ParseConsoleLog from Common.BuildVersion import gBUILD_VERSION from Parser import ConvertGuid from Common.LongFilePathSupport import OpenLongFilePath as open --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel