I would like to replace all use of string constants with the ones in DataType.  
I just didn't get to the rest.

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Tuesday, April 10, 2018 6:08 PM
> To: Carsey, Jaben <jaben.car...@intel.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming....@intel.com>; Zhu, Yonghong
> <yonghong....@intel.com>
> Subject: RE: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw
> strings in python code.
> Importance: High
> 
> Hi Jaben,
> 
> Seems only replaced 'UEFI_APPLICATION', what about others, eg '
> DXE_SMM_DRIVER' ? Do you have plan to update it  ?
> 
> Best Regards,
> Zhu Yonghong
> 
> 
> -----Original Message-----
> From: Carsey, Jaben
> Sent: Tuesday, April 10, 2018 10:20 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming....@intel.com>; Zhu, Yonghong
> <yonghong....@intel.com>
> Subject: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw
> strings in python code.
> 
> Cc: Liming Gao <liming....@intel.com>
> Cc: Yonghong Zhu <yonghong....@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jaben Carsey <jaben.car...@intel.com>
> ---
>  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'].Replac
> e(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'].Replac
> e(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'].Replac
> e(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].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
> 
>  ## 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_APPLIC
> ATION
> 
>  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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to