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.100; helo=mga07.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 A24772270D33F for ; Tue, 10 Apr 2018 07:20:10 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2018 07:20:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,432,1517904000"; d="scan'208";a="190327387" Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.141]) by orsmga004.jf.intel.com with ESMTP; 10 Apr 2018 07:20:09 -0700 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Tue, 10 Apr 2018 07:20:08 -0700 Message-Id: <5fcb2d09d32b4ebe8dfd5d38f8e2099247ef9bd8.1523369916.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [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: Tue, 10 Apr 2018 14:20:10 -0000 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(-) 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 ## PCD type string gItemTypeStringDatabase = { @@ -782,7 +783,7 @@ gModuleTypeHeaderFile = { "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/DebugLib.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): ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) 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']: ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) 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): DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) 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_APPLICATION', 'SMM_CORE']: + 'DXE_SAL_DRIVER','UEFI_DRIVER',SUP_MODULE_UEFI_APPLICATION, 'SMM_CORE']: DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) 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(Dict)) AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType == 'UEFI_APPLICATION': + elif Info.ModuleType == SUP_MODULE_UEFI_APPLICATION: if NumEntryPoints < 2: AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(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 ## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END" gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S) @@ -40,7 +41,7 @@ gType2Phase = { "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 ## 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_APPLICATION 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", } 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 ## Pattern to extract contents in EDK DXS files gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) @@ -117,7 +118,7 @@ gDriverTypeMap = { '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 support PI 1.1 SMM drivers 'MM_STANDALONE' : '0xE (MM_STANDALONE)', @@ -410,7 +411,7 @@ class DepexReport(object): if not ModuleType: ModuleType = gComponentType2ModuleType.get(M.ComponentType, "") - 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 for Source in M.SourceFileList: -- 2.16.2.windows.1