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 15/27] BaseTools: Share a dictionary instead of keeping multiples
Date: Fri, 20 Apr 2018 08:51:35 -0700 [thread overview]
Message-ID: <cf26f4f0e59a739cee691f7c18096ddc57180b29.1524239027.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1524239027.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1524239027.git.jaben.carsey@intel.com>
Move a dictionary to a shared location and use from there
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/Common/DataType.py | 15 ++++++++++++
BaseTools/Source/Python/Workspace/InfBuildData.py | 24 ++------------------
BaseTools/Source/Python/build/BuildReport.py | 19 ++--------------
3 files changed, 19 insertions(+), 39 deletions(-)
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 06e8defcf927..ab9acb417331 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -92,6 +92,21 @@ EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION'
EDK_NAME = 'EDK'
EDKII_NAME = 'EDKII'
+COMPONENT_TO_MODULE_MAP_DICT = {
+ "LIBRARY" : SUP_MODULE_BASE,
+ "SECURITY_CORE" : SUP_MODULE_SEC,
+ SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE,
+ "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM,
+ "PIC_PEIM" : SUP_MODULE_PEIM,
+ "RELOCATABLE_PEIM" : SUP_MODULE_PEIM,
+ "PE32_PEIM" : SUP_MODULE_PEIM,
+ "BS_DRIVER" : SUP_MODULE_DXE_DRIVER,
+ "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER,
+ "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER,
+ "APPLICATION" : SUP_MODULE_UEFI_APPLICATION,
+ "LOGO" : SUP_MODULE_BASE,
+}
+
BINARY_FILE_TYPE_FW = 'FW'
BINARY_FILE_TYPE_GUID = 'GUID'
BINARY_FILE_TYPE_PREEFORM = 'PREEFORM'
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index f2d36d0ee0d4..d64a281a98f7 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -66,26 +66,6 @@ class InfBuildData(ModuleBuildClassObject):
TAB_COMPONENTS_SOURCE_OVERRIDE_PATH : "_SourceOverridePath",
}
- # dict used to convert Component type to Module type
- _MODULE_TYPE_ = {
- "LIBRARY" : SUP_MODULE_BASE,
- "SECURITY_CORE" : SUP_MODULE_SEC,
- SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE,
- "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM,
- "PIC_PEIM" : SUP_MODULE_PEIM,
- "RELOCATABLE_PEIM" : SUP_MODULE_PEIM,
- "PE32_PEIM" : SUP_MODULE_PEIM,
- "BS_DRIVER" : SUP_MODULE_DXE_DRIVER,
- "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER,
- "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER,
- SUP_MODULE_DXE_SMM_DRIVER : SUP_MODULE_DXE_SMM_DRIVER,
- # "SMM_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER,
- # "BS_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER,
- # "BS_DRIVER" : SUP_MODULE_UEFI_DRIVER,
- "APPLICATION" : SUP_MODULE_UEFI_APPLICATION,
- "LOGO" : SUP_MODULE_BASE,
- }
-
# regular expression for converting XXX_FLAGS in [nmake] section to new type
_NMAKE_FLAG_PATTERN_ = re.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re.UNICODE)
# dict used to convert old tool name used in [nmake] section to new ones
@@ -362,8 +342,8 @@ class InfBuildData(ModuleBuildClassObject):
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
"COMPONENT_TYPE is not given", File=self.MetaFile)
self._BuildType = self._ComponentType.upper()
- if self._ComponentType in self._MODULE_TYPE_:
- self._ModuleType = self._MODULE_TYPE_[self._ComponentType]
+ if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT:
+ self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType]
if self._ComponentType == 'LIBRARY':
self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]
# make use some [nmake] section macros
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 2dfd78cb9538..5846c2870d2e 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -47,21 +47,6 @@ from Common.DataType import *
import collections
from Common.Expression import *
-gComponentType2ModuleType = {
- "LIBRARY" : SUP_MODULE_BASE,
- "SECURITY_CORE" : SUP_MODULE_SEC,
- SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE,
- "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM,
- "PIC_PEIM" : SUP_MODULE_PEIM,
- "RELOCATABLE_PEIM" : SUP_MODULE_PEIM,
- "PE32_PEIM" : SUP_MODULE_PEIM,
- "BS_DRIVER" : SUP_MODULE_DXE_DRIVER,
- "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER,
- "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER,
- "APPLICATION" : SUP_MODULE_UEFI_APPLICATION,
- "LOGO" : SUP_MODULE_BASE,
-}
-
## Pattern to extract contents in EDK DXS files
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
@@ -422,7 +407,7 @@ class DepexReport(object):
self._DepexFileName = os.path.join(M.BuildDir, "OUTPUT", M.Module.BaseName + ".depex")
ModuleType = M.ModuleType
if not ModuleType:
- ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
+ ModuleType = COMPONENT_TO_MODULE_MAP_DICT.get(M.ComponentType, "")
if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UEFI_APPLICATION]:
return
@@ -587,7 +572,7 @@ class ModuleReport(object):
if not M.IsLibrary:
ModuleType = M.ModuleType
if not ModuleType:
- ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")
+ ModuleType = COMPONENT_TO_MODULE_MAP_DICT.get(M.ComponentType, "")
#
# If a module complies to PI 1.1, promote Module type to "SMM_DRIVER"
#
--
2.16.2.windows.1
next prev parent reply other threads:[~2018-04-20 15:51 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 15:51 [PATCH v1 00/27] BaseTools refactoring Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 01/27] BaseTools: Misc - refactor RegEx to minimize multiple compiling Jaben Carsey
2018-04-25 8:49 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 02/27] BaseTools: GenPatchPcdTable " Jaben Carsey
2018-04-25 8:50 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 03/27] BaseTools: Share RegEx between files Jaben Carsey
2018-04-25 8:51 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 04/27] BaseTools: Workspace - refactor RegEx to minimize multiple compiling Jaben Carsey
2018-04-25 8:50 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 05/27] BaseTools: Autogen - replace string constants with those from DataType Jaben Carsey
2018-04-25 8:50 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 06/27] BaseTools: simplify if call Jaben Carsey
2018-04-25 8:50 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 07/27] BaseTools: Workspace - refactor GetStructurePcdInfo Jaben Carsey
2018-04-25 8:50 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 08/27] BaseTools: AutoGen - remove dictionary populated, but never accessed Jaben Carsey
2018-04-25 8:50 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 09/27] BaseTools: AutoGen - remove unused variables Jaben Carsey
2018-04-25 8:52 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 10/27] BaseTools: Remove extra .keys() Jaben Carsey
2018-04-25 8:51 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 12/27] BaseTools: remove dict from DscBuildData Jaben Carsey
2018-04-25 8:50 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 13/27] BaseTools: replace string constants used for module types Jaben Carsey
2018-04-25 5:57 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 14/27] BaseTools: Define and use a set for common list Jaben Carsey
2018-05-02 6:48 ` Zhu, Yonghong
2018-04-20 15:51 ` Jaben Carsey [this message]
2018-04-20 15:51 ` [PATCH v1 16/27] BaseTools: Replace EDK Component strings with predefined constant Jaben Carsey
2018-04-24 7:42 ` Zhu, Yonghong
2018-04-24 14:13 ` Carsey, Jaben
2018-04-20 15:51 ` [PATCH v1 17/27] BaseTools: DataType - cleanup list constants Jaben Carsey
2018-05-04 11:14 ` Laszlo Ersek
2018-05-04 14:18 ` Carsey, Jaben
2018-05-04 15:03 ` Laszlo Ersek
2018-04-20 15:51 ` [PATCH v1 18/27] BaseTools: Replace PCD type strings with predefined constant Jaben Carsey
2018-04-25 6:00 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 19/27] BaseTools: Replace Binary File " Jaben Carsey
2018-04-24 7:38 ` Zhu, Yonghong
2018-04-24 14:12 ` Carsey, Jaben
2018-04-20 15:51 ` [PATCH v1 20/27] BaseTools: remove duplicate variable Jaben Carsey
2018-04-25 8:51 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 21/27] BaseTools: replace string with predefined constant Jaben Carsey
2018-04-25 6:04 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 22/27] BaseTools: remove redundant if comparison Jaben Carsey
2018-05-02 6:49 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 23/27] BaseTools: AutoGen - use dafultdict instead of dict Jaben Carsey
2018-04-20 15:51 ` [PATCH v1 24/27] BaseTools: GenFds - simplify testing for Hex number Jaben Carsey
2018-04-25 8:51 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 25/27] BaseTools: AutoGen - use defaultdict to auto initialize Jaben Carsey
2018-04-25 8:52 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py Jaben Carsey
2018-05-02 6:49 ` Zhu, Yonghong
2018-04-20 15:51 ` [PATCH v1 27/27] BaseTools: CommonClass - remove unused classes Jaben Carsey
2018-04-25 8:51 ` Zhu, Yonghong
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=cf26f4f0e59a739cee691f7c18096ddc57180b29.1524239027.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