From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 3/3] BaseTools: use existing contrants to replace raw strings in python code.
Date: Tue, 10 Apr 2018 07:20:08 -0700 [thread overview]
Message-ID: <5fcb2d09d32b4ebe8dfd5d38f8e2099247ef9bd8.1523369916.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1523369916.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1523369916.git.jaben.carsey@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@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'].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
next prev parent reply other threads:[~2018-04-10 14:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 14:20 [PATCH v1 0/3] BaseTools: refactor to remove redundant Jaben Carsey
2018-04-10 14:20 ` [PATCH v1 1/3] BaseTools: refactor and remove more keys() usage Jaben Carsey
2018-04-18 8:48 ` Zhu, Yonghong
2018-04-10 14:20 ` [PATCH v1 2/3] BaseTools: use predefined constants instead of local strings Jaben Carsey
2018-04-16 1:43 ` Zhu, Yonghong
2018-04-10 14:20 ` Jaben Carsey [this message]
2018-04-11 1:07 ` [PATCH v1 3/3] BaseTools: use existing contrants to replace raw strings in python code Zhu, Yonghong
2018-04-11 14:20 ` Carsey, Jaben
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5fcb2d09d32b4ebe8dfd5d38f8e2099247ef9bd8.1523369916.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox