New sets will get created automatically when needed
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/AutoGen.py | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 3384fdb70b7e..91a0742a33be 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -45,6 +45,7 @@ import InfSectionParser
import datetime
import hashlib
from GenVar import VariableMgr,var_info
+from collections import defaultdict
## Regular expression for splitting Dependency Expression string into tokens
gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
@@ -3495,8 +3496,8 @@ class ModuleAutoGen(AutoGen):
if self._BuildTargets is None:
self._IntroBuildTargetList = set()
self._FinalBuildTargetList = set()
- self._BuildTargets = {}
- self._FileTypes = {}
+ self._BuildTargets = defaultdict(set)
+ self._FileTypes = defaultdict(set)
SubDirectory = os.path.join(self.OutputDir, File.SubDir)
if not os.path.exists(SubDirectory):
@@ -3533,8 +3534,6 @@ class ModuleAutoGen(AutoGen):
break
FileType = RuleObject.SourceFileType
- if FileType not in self._FileTypes:
- self._FileTypes[FileType] = set()
self._FileTypes[FileType].add(Source)
# stop at STATIC_LIBRARY for library
@@ -3552,8 +3551,6 @@ class ModuleAutoGen(AutoGen):
# Only do build for target with outputs
self._FinalBuildTargetList.add(Target)
- if FileType not in self._BuildTargets:
- self._BuildTargets[FileType] = set()
self._BuildTargets[FileType].add(Target)
if not Source.IsBinary and Source == File:
@@ -3572,8 +3569,8 @@ class ModuleAutoGen(AutoGen):
if self._BuildTargets is None:
self._IntroBuildTargetList = set()
self._FinalBuildTargetList = set()
- self._BuildTargets = {}
- self._FileTypes = {}
+ self._BuildTargets = defaultdict(set)
+ self._FileTypes = defaultdict(set)
#TRICK: call _GetSourceFileList to apply build rule for source files
if self.SourceFileList:
--
2.16.2.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel