From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 765D522742A84 for ; Wed, 11 Apr 2018 07:20:21 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2018 07:20:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,436,1517904000"; d="scan'208";a="31886042" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga008.fm.intel.com with ESMTP; 11 Apr 2018 07:20:19 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 11 Apr 2018 07:20:18 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.89]) by FMSMSX152.amr.corp.intel.com ([169.254.6.121]) with mapi id 14.03.0319.002; Wed, 11 Apr 2018 07:20:18 -0700 From: "Carsey, Jaben" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw strings in python code. Thread-Index: AQHT0TF8Oy1BQL/1jUu9B2HdANVuj6P7nSNw Date: Wed, 11 Apr 2018 14:20:18 +0000 Message-ID: References: <5fcb2d09d32b4ebe8dfd5d38f8e2099247ef9bd8.1523369916.git.jaben.carsey@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzc4MTk2ZWMtY2ZiNi00NGVjLTgzOTItNTRiMmM3MzI2OThlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im9ETFdSaFo5b2RPbXo5SU1xUXBCZnJFdGIwS05kbWtGWkpcLzd3eHBhdmNjPSJ9 x-ctpclassification: CTP_NT x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw strings in python 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: , X-List-Received-Date: Wed, 11 Apr 2018 14:20:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I would like to replace all use of string constants with the ones in DataTy= pe. I just didn't get to the rest. > -----Original Message----- > From: Zhu, Yonghong > Sent: Tuesday, April 10, 2018 6:08 PM > To: Carsey, Jaben ; edk2-devel@lists.01.org > Cc: Gao, Liming ; Zhu, Yonghong > > Subject: RE: [PATCH v1 3/3] BaseTools: use existing contrants to replace = raw > strings in python code. > Importance: High >=20 > Hi Jaben, >=20 > Seems only replaced 'UEFI_APPLICATION', what about others, eg ' > DXE_SMM_DRIVER' ? Do you have plan to update it ? >=20 > Best Regards, > Zhu Yonghong >=20 >=20 > -----Original Message----- > From: Carsey, Jaben > Sent: Tuesday, April 10, 2018 10:20 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming ; Zhu, Yonghong > > Subject: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw > strings in python code. >=20 > Cc: Liming Gao > Cc: Yonghong Zhu > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jaben Carsey > --- > BaseTools/Source/Python/AutoGen/GenC.py | 13 +++++++------ > BaseTools/Source/Python/AutoGen/GenDepex.py | 3 ++- > BaseTools/Source/Python/GenFds/Ffs.py | 3 ++- > BaseTools/Source/Python/Workspace/InfBuildData.py | 4 ++-- > BaseTools/Source/Python/build/BuildReport.py | 5 +++-- > 5 files changed, 16 insertions(+), 12 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenC.py > b/BaseTools/Source/Python/AutoGen/GenC.py > index 4d9ea1b2a8b1..4a9657420897 100644 > --- a/BaseTools/Source/Python/AutoGen/GenC.py > +++ b/BaseTools/Source/Python/AutoGen/GenC.py > @@ -25,6 +25,7 @@ from Common.String import StringToArray from > StrGather import * from GenPcdDb import CreatePcdDatabaseCode from > IdfClassObject import * > +from Common.DataType import SUP_MODULE_UEFI_APPLICATION >=20 > ## PCD type string > gItemTypeStringDatabase =3D { > @@ -782,7 +783,7 @@ gModuleTypeHeaderFile =3D { > "DXE_RUNTIME_DRIVER": ["PiDxe.h", "Library/BaseLib.h", > "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", > "Library/UefiDriverEntryPoint.h"], > "DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", > "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", > "Library/UefiDriverEntryPoint.h"], > "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/De= bugLib.h", > "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], > - "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", > "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", > "Library/UefiApplicationEntryPoint.h"], > + SUP_MODULE_UEFI_APPLICATION : ["Uefi.h", "Library/BaseLib.h", > "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", > "Library/UefiApplicationEntryPoint.h"], > "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", > "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"], > "MM_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", > "Library/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"], > "MM_CORE_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", > "Library/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"], > @@ -1386,7 +1387,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, > AutoGenH): >=20 > ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replac > e(Dict)) >=20 > ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)= ) > elif Lib.ModuleType in > ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', > - > 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: > + > 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE_UEFI_APPLICATION,'SMM > _CORE']: >=20 > ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replac > e(Dict)) >=20 > ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict)= ) > elif Lib.ModuleType in > ['MM_STANDALONE','MM_CORE_STANDALONE']: > @@ -1415,7 +1416,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, > AutoGenH): > elif Info.ModuleType in ['PEI_CORE','PEIM']: > AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) > elif Info.ModuleType in > ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', > - > 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: > + > 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE_UEFI_APPLICATION,'SMM > _CORE']: > AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) > elif Info.ModuleType in > ['MM_STANDALONE','MM_CORE_STANDALONE']: > AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) > @@ -1448,7 +1449,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, > AutoGenH): >=20 > DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace > (Dict)) >=20 > DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)) > elif Lib.ModuleType in > ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', > - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APP= LICATION', > 'SMM_CORE']: > + > 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE_UEFI_APPLICATION, > 'SMM_CORE']: >=20 > DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replac > e(Dict)) >=20 > DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict)) > elif Lib.ModuleType in > ['MM_STANDALONE','MM_CORE_STANDALONE']: > @@ -1477,7 +1478,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, > AutoGenH): > elif Info.ModuleType in ['PEI_CORE','PEIM']: > AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) > elif Info.ModuleType in > ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', > - > 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: > + > 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE_UEFI_APPLICATION,'SMM > _CORE']: > AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) > elif Info.ModuleType in > ['MM_STANDALONE','MM_CORE_STANDALONE']: > AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) > @@ -1556,7 +1557,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, > AutoGenH): > else: > AutoGenC.Append(gMmStandaloneEntryPointString[2].Replace(Dic= t)) > AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict)) > - elif Info.ModuleType =3D=3D 'UEFI_APPLICATION': > + elif Info.ModuleType =3D=3D SUP_MODULE_UEFI_APPLICATION: > if NumEntryPoints < 2: >=20 > AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Repla > ce(Dict)) > else: > diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py > b/BaseTools/Source/Python/AutoGen/GenDepex.py > index 9acea8f6bfed..8896ad65bfe6 100644 > --- a/BaseTools/Source/Python/AutoGen/GenDepex.py > +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py > @@ -24,6 +24,7 @@ from Common.Misc import SaveFileOnChange from > Common.Misc import GuidStructureStringToGuidString from Common > import EdkLogger as EdkLogger from Common.BuildVersion import > gBUILD_VERSION > +from Common.DataType import SUP_MODULE_UEFI_APPLICATION >=20 > ## Regular expression for matching "DEPENDENCY_START ... > DEPENDENCY_END" > gStartClosePattern =3D > re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S) @@ -40,7 > +41,7 @@ gType2Phase =3D { > "DXE_RUNTIME_DRIVER": "DXE", > "DXE_SAL_DRIVER" : "DXE", > "UEFI_DRIVER" : "DXE", > - "UEFI_APPLICATION" : "DXE", > + SUP_MODULE_UEFI_APPLICATION : "DXE", > "SMM_CORE" : "DXE", > "MM_STANDALONE" : "MM", > "MM_CORE_STANDALONE" : "MM", > diff --git a/BaseTools/Source/Python/GenFds/Ffs.py > b/BaseTools/Source/Python/GenFds/Ffs.py > index a4178121118b..e5b180eb9324 100644 > --- a/BaseTools/Source/Python/GenFds/Ffs.py > +++ b/BaseTools/Source/Python/GenFds/Ffs.py > @@ -16,6 +16,7 @@ > # Import Modules > # > from CommonDataClass.FdfClass import FDClassObject > +from Common.DataType import SUP_MODULE_UEFI_APPLICATION >=20 > ## generate FFS > # > @@ -33,7 +34,7 @@ class Ffs(FDClassObject): > 'DXE_SMM_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', > 'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER', > 'UEFI_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', > - 'UEFI_APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', > + SUP_MODULE_UEFI_APPLICATION : 'EFI_FV_FILETYPE_APPLICATION', > 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE', > 'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE', > 'MM_CORE_STANDALONE' : > 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' > diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py > b/BaseTools/Source/Python/Workspace/InfBuildData.py > index 53aa6acf5862..c1841487f64f 100644 > --- a/BaseTools/Source/Python/Workspace/InfBuildData.py > +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py > @@ -17,7 +17,7 @@ from Common.DataType import * from Common.Misc > import * from types import * from MetaFileParser import * -from > Common.DataType import TAB_ARCH_COMMON,TAB_ARCH_COMMON > +from Common.DataType import > +TAB_ARCH_COMMON,TAB_ARCH_COMMON,SUP_MODULE_UEFI_APPLIC > ATION >=20 > from Workspace.BuildClassObject import ModuleBuildClassObject, > LibraryClassObject, PcdClassObject ## Module build information from INF > file @@ -82,7 +82,7 @@ class InfBuildData(ModuleBuildClassObject): > # "SMM_DRIVER" : "DXE_SMM_DRIVER", > # "BS_DRIVER" : "DXE_SMM_DRIVER", > # "BS_DRIVER" : "UEFI_DRIVER", > - "APPLICATION" : "UEFI_APPLICATION", > + "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, > "LOGO" : "BASE", > } >=20 > diff --git a/BaseTools/Source/Python/build/BuildReport.py > b/BaseTools/Source/Python/build/BuildReport.py > index 966a2aa5abf1..190b58cfa44e 100644 > --- a/BaseTools/Source/Python/build/BuildReport.py > +++ b/BaseTools/Source/Python/build/BuildReport.py > @@ -47,6 +47,7 @@ from Common.String import NormPath from > Common.DataType import * import collections from Common.Expression > import * > +from Common.DataType import SUP_MODULE_UEFI_APPLICATION >=20 > ## Pattern to extract contents in EDK DXS files gDxsDependencyPattern = =3D > re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) @@ - > 117,7 +118,7 @@ gDriverTypeMap =3D { > 'DXE_SMM_DRIVER' : '0x7 (DRIVER)', > 'DXE_RUNTIME_DRIVER': '0x7 (DRIVER)', > 'UEFI_DRIVER' : '0x7 (DRIVER)', > - 'UEFI_APPLICATION' : '0x9 (APPLICATION)', > + SUP_MODULE_UEFI_APPLICATION : '0x9 (APPLICATION)', > 'SMM_CORE' : '0xD (SMM_CORE)', > 'SMM_DRIVER' : '0xA (SMM)', # Extension of module type to suppo= rt PI > 1.1 SMM drivers > 'MM_STANDALONE' : '0xE (MM_STANDALONE)', > @@ -410,7 +411,7 @@ class DepexReport(object): > if not ModuleType: > ModuleType =3D > gComponentType2ModuleType.get(M.ComponentType, "") >=20 > - if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", > "MM_CORE_STANDALONE", "UEFI_APPLICATION"]: > + if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", > "MM_CORE_STANDALONE", SUP_MODULE_UEFI_APPLICATION]: > return >=20 > for Source in M.SourceFileList: > -- > 2.16.2.windows.1